On Sun, 4 May 2025 17:51:48 GMT, Luca Kellermann <d...@openjdk.org> wrote:

>> Stuart Marks has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Reversed view of SynchronizedRandomAccessList should also be RandomAccess.
>>   Add tests to ensure RandomAccess is preserved when reversing.
>
> src/java.base/share/classes/java/util/Collections.java line 2837:
> 
>> 2835:                 return reversedView;
>> 2836:             }
>> 2837:         }
> 
> `SynchronizedRandomAccessList` overrides `subList`, should it also override 
> `reversed`?

Good point, yes it should! At least, it should ensure that the reversed view of 
a random access synchronized list should also be random access -- which the 
current code doesn't do. Overriding reversed() in the RA subclass is probably 
the clearest way to do that. I'll also take the opportunity to expand test 
coverage, as I don't think the reversed-view-of-RA-is-also-RA is covered 
anywhere.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24990#discussion_r2074366852

Reply via email to