On Fri, 21 Jul 2023 11:16:11 GMT, Hollis Waite <d...@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 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 > > It'd be convenient if SequencedCollection overrode Iterable.iterator() to > return a ListIterator. That would make it simpler to derive a List from > LinkedHashMap.values(). > @hwaite, the problem is that the derived List will not be a random access > List, so it will perform badly with any code that loop over List.get() (yes, > you are not supposed to do that but sadly a lot of people do). Pardon? What about semantics mismatch and compatibility issues? If SequencedCollection were to redefine `iterator` as follows, it would break all the existing implementations of List out there: @Override ListIterator<E> iterator(); ------------- PR Comment: https://git.openjdk.org/jdk/pull/7387#issuecomment-1645667941