Prev Next

Java / List and its implementations

Explain CopyOnWriteArrayList in Java collections.

CopyOnWriteArrayList implements List interface but its a thread-safe collection.

CopyOnWriteArrayList creates copy of underlying ArrayList with every mutation operation e.g. add or set. Normally CopyOnWriteArrayList is very expensive because it involves costly Array copy with every write operation but its very efficient if you have a List where Iteration outnumber mutation.

More Related questions...

Show more question and Answers...


Comments & Discussions