Inefficient indexOf called inside of CopyOnWriteArrayList$COWSubList.remove(Object)

Martin Buchholz martinrb at google.com
Mon Mar 26 18:58:47 UTC 2018


I filed
https://bugs.openjdk.java.net/browse/JDK-8200258
and added comment:

I agree that CopyOnWriteArrayList subList code can be improved.
We should stop subclassing AbstractList.
We should add more tests.
We should have more guidance about when to use index-based API - only when
quiescent or thread-confined. Explain how to most efficiently create a
snapshot - probably
 snapshot = new CopyOnWriteArrayList(sharedCOWAL)


More information about the core-libs-dev mailing list