On Tue, 24 Feb 2026 20:42:03 GMT, Eirik Bjørsnøs <[email protected]> wrote:

> The synchronized wrapper collections clearly specify that the user is 
> responsible for synchronizing any iteration or stream operations on those 
> collections. Then, who is the user in this case? The one creating and passing 
> synchronzed collections around, or do we include any collection in the 
> collections framework?

Using iterator to perform copying has a history of problems. See:
https://bugs.openjdk.org/browse/JDK-6347106 and linked tickets.

My advice is to not undo that ticket.

> 
> To avoid further headscratching about this, perhaps a good old anonymous 
> class would be less risky?
> 
> ```java
> c.forEach(new Consumer<E>() {
>     @Override
>     public void accept(E e) {
>         addLast(e);
>     }
> });
> ```

Yes. Thanks!

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

PR Comment: https://git.openjdk.org/jdk/pull/29894#issuecomment-3955982977

Reply via email to