On Mon, 5 May 2025 23:36:35 GMT, Stuart Marks <sma...@openjdk.org> wrote:

>> Collections.synchronizedList() returns a List implementation that doesn't do 
>> proper locking. This PR does the following on the synchronized wrapper:
>> 
>> - overrides and adds locking to SequencedCollection methods;
>> - performs instance management of reversed synchronized views;
>> - adds test for race conditions and functional tests of synchronized 
>> wrappers.
>
> 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 2782:

> 2780:             synchronized (mutex) {list.sort(c);}
> 2781:         }
> 2782:         public void addFirst(E element) {

Are these overloads strictly needed as the `default` implementations will 
delegate to `get` and `set`, which, in turn, are thread safe?

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

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

Reply via email to