Prev Next

Java / List and its implementations

Difference between CopyOnWriteArrayList and ArrayList in Java.

CopyOnWriteArrayList is a thread-safe collection while ArrayList is not thread-safe.

Iterator of ArrayList is fail-fast and throw ConcurrentModificationException once detect any modification in List once iteration begins but Iterator of CopyOnWriteArrayList is fail-safe and doesn't throw ConcurrentModificationException.

Iterator of CopyOnWriteArrayList doesn't support remove operation while ArrayList Iterator supports remove() operation.

More Related questions...

Show more question and Answers...


Comments & Discussions