RFR: 8266571: Sequenced Collections [v5]
Stuart Marks
smarks at openjdk.org
Sat Apr 15 03:25:57 UTC 2023
On Thu, 3 Nov 2022 20:33:40 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Stuart Marks has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 80 commits:
>>
>> - Merge branch 'master' into JDK-8266571-SequencedCollections
>> - Simplify handling of cached keySet, values, and entrySet views.
>> - Merge branch 'master' into JDK-8266571-SequencedCollections
>> - Update copyrights.
>> - More specification tweaks.
>> - Add simple overrides to ArrayList.
>> - Specification cleanups.
>> - Update spec of CopyOnWriteArrayList::reversed.
>> - Move AbstractViewCollection to AbstractMap.ViewCollection to avoid exposing it publicly.
>> - Merge branch 'master' into JDK-8266571-SequencedCollections
>> Resolve conflict by deleting IdentityLinkedList.java
>> - ... and 70 more: https://git.openjdk.org/jdk/compare/76cda9f4...1332c3e2
>
> src/java.base/share/classes/java/util/SortedSet.java line 303:
>
>> 301: * @since 20
>> 302: */
>> 303: default E removeFirst() {
>
> Should removeFirst/removeLast be overridden in NavigableSet with a new default implementation like:
>
> if (this.isEmpty()) {
> throw new NoSuchElementException();
> }
> return this.pollFirst();
>
> which is probably slightly more efficient?
Good idea, I'll do this now that I'm revisiting the specs of the default methods.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1167365546
More information about the core-libs-dev
mailing list