RFR: 8266571: Sequenced Collections [v12]

Pavel Rappo prappo at openjdk.org
Fri Jul 21 16:58:28 UTC 2023


On Mon, 24 Apr 2023 21:39:43 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> PR for Sequenced Collections implementation.
>
> Stuart Marks has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 96 commits:
> 
>  - Merge branch 'master' into JDK-8266571-SequencedCollections
>  - Optimizations for ReverseOrderListView; check indexes in reversed domain.
>  - Wording tweaks to SequencedMap / NavigableMap.
>  - Change "The implementation in this class" to "... interface."
>  - Delegate more methods in the views of ReverseOrderSortedMapView.
>  - Add missing @throws and @since tags.
>  - Convert code samples to snippets.
>  - Various editorial changes.
>  - Fix up toArray(T[]) on reverse-ordered views.
>  - Remove unnecessary 'final' from a couple places.
>  - ... and 86 more: https://git.openjdk.org/jdk/compare/2ea62c13...2827aa69

Additional observation. List API is highly expressive and combinable like Lego® bricks. Have a list? Have a subrange in mind that you want to iterate backwards in a for 
-loop? No problem!

    for (var e : list.subList(from, to).reversed())
        ...

SequencedCollection is weaker than List, but stronger than Collection. If you want maximum flexibility and convenience use the strongest type you possibly can.

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

PR Comment: https://git.openjdk.org/jdk/pull/7387#issuecomment-1645990527


More information about the core-libs-dev mailing list