RFR: 8266571: Sequenced Collections

Stuart Marks smarks at openjdk.org
Mon Mar 20 23:45:08 UTC 2023


On Sun, 28 Aug 2022 05:45:54 GMT, Grzegorz Piwowarek <duke at openjdk.org> wrote:

>> PR for Sequenced Collections implementation.
>
> src/java.base/share/classes/java/util/SequencedCollection.java line 84:
> 
>> 82:      * the iterator() method, calls next() on it and returns the result.
>> 83:      */
>> 84:     default E getFirst() {
> 
> Too bad there's no `Optional<E>` here, but I assume that's because you don't want to mix two approaches within a class hierarchy?

I wanted to make `getFirst` et. al. be identical to the methods already in `Deque`, to avoid proliferation of methods.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r957518311


More information about the core-libs-dev mailing list