CopyOnWriteArrayList vs syncronizedList() vs vector

CopyOnWriteArrayListsyncronizedList()Vector
Thread safety achieved by creating a copy of arrayListThread safety is achieved by allowing only one thread to access at a timeThread safety is achieved by allowing only one thread to access at a time
At a time multiple Threads can accessAt a time one Thread can only accessAt a time one Thread can only access
While Iterating if modified we will not get ConcurrentModificationExceptionWhile Iterating if modified we will get ConcurrentModificationExceptionWhile Iterating if modified we will get ConcurrentModificationException
Iterator is fail safeIterator is fail fastIterator is fail fast
Cannot remove from Iteratror will throw UnsupportedOperatorExceptionCan read and remove from IteratorCan read and remove from Iterator
From Java 1.5 versionFrom Java 1.2 versionFrom Java 1.0 version

Leave a Comment