Difference between Arraylist and Vector in java

1)SynchronizedArrayList is not SynchronizedVector is Synchronized
2)Thread safetySince ArrayList is not Synchronized, it's not thread safe means multiple threads can operate simultaneoulsy on ArrayListSince Vector is Synchronized, it's thread safe means only one thread can operate at time on Vector
3)Execution speedSince multiple threads can operate of ArrayList its fasterSince only one thread operate at time on Vector its slow as compared to ArrayList
4)CapacityNew capacity of Arraylist =( Initial capacity +(Initial capacity*3/2)+1)New capacity of Vector =2* initial capacity
5)Data retrivalWe can retrive data from ArrayList using iterator() onlyWe can retrive data from Vector using iterator() as well as elements()
6)DuplicatesDuplicates are allowed in ArrayListDuplicates are also allowed in Vector
7)Null insertionNull insertion is allowed in ArrayListNull insertion is also allowed in Vector
8)Insertion OrderInsertion order is preserved in ArrayListInsertion order is preserved in Vector

You may also like...