RFR: 8356486: ReverseOrderListView should override reversed() to return `base`

Per Minborg pminborg at openjdk.org
Fri May 9 06:27:54 UTC 2025


On Thu, 8 May 2025 16:13:19 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> test/jdk/java/util/Collection/MOAT.java line 507:
>> 
>>> 505:     private static <T> void testImmutableSeqColl(final SequencedCollection<T> c, T t) {
>>> 506:         SequencedCollection<T> r = c.reversed();
>>> 507:         if (r instanceof List<T> list && list.reversed() != c) {
>> 
>> Shouldn't all double-reverse be identity? Why is this restricted to lists?
>
> This should already be covered by the testDoubleReverse() test in test/jdk/java/util/SequencedCollection/Basic.java.

There are some new collections (such as StableList) that are not covered in Basic. But maybe they should have their separate tests?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25120#discussion_r2081013384


More information about the core-libs-dev mailing list