RFR: 8180352: Add Stream.toList() method [v3]
Stuart Marks
smarks at openjdk.java.net
Tue Nov 24 03:54:03 UTC 2020
On Sat, 21 Nov 2020 11:02:27 GMT, Rémi Forax <github.com+828220+forax at openjdk.org> wrote:
>> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Adjust List.copyOf to null-check and copy allowNulls lists.
>> Fix equals, hashCode, indexOf, lastIndexOf to handle nulls properly.
>> Add MOAT tests for new lists; add equals and hashCode tests.
>
> src/java.base/share/classes/java/util/ImmutableCollections.java line 222:
>
>> 220: default:
>> 221: return (List<E>) new ListN<>(input, false);
>> 222: }
>
> Using a switch expression + arrow (->) here will allow you too factor the cast, even if it disappear in the generated bytecode, I think it makes the code more readable
Heh yes, I haven't gotten used to using those yet!
-------------
PR: https://git.openjdk.java.net/jdk/pull/1026
More information about the core-libs-dev
mailing list