ArrayList vs CopyOnWriteArrayList

ArrayListConcurrentArrayList
It is not Thread safeIt is ThreadSafe since a copy of list is created on which updates are performed
While one thread is iterating other thread write into the list we will get concurrentModifciationExceptionDoes not give ConcurrentModificationException when added to ArrayList while Iterating
Iterator is failfastIterator is failsafe
Iterator is ArrayList can remove Iterator is CopyOnWriteArrayList cannot remove throw UnsupportedOperationException
Introduced in java v1.2Introduced in java v1.5

Leave a Comment