Tags

,

links:
http://javarevisited.blogspot.com/2011/09/difference-vector-vs-arraylist-in-java.html
http://techvivek.wordpress.com/2009/08/29/difference-between-arraylist-and-copyonwritearraylist/
http://javahungry.blogspot.com/2013/12/difference-between-arraylist-and-vector-in-java-collection-interview-question.html

Vector:
– thread safe with “lock”
– no List interface originally in 1.0
– since 1.2 retrofitted to implement the List interface
– Enumerator, Iterator, ListIterator
– both multithread add and remove ok

ArrayList:
– thread unsafe
– List interface
– Iterator, ListIterator
– can’t multithread add (failfast); remove ok

CopyOnWriteArrayList:
– thread safe WITHOUT “lock”
– List interface
– Iterator, ListIterator
– Element-changing operations on “iterators” themselves (remove, set, and add) are not supported, UnsupportedOperationException.

Advertisements