Skip to main content
What is the difference between ArrayList and Vector in Java ?
ArrayList Vs Vector
1.ArrayList is not synchronised but where as Vector is synchronised.
2.ArrayList provides high performance but Vector is low performance.
3.In ArrayList increment size cannot be specified but In vector increment size can be provided.
4.In ArrayList does not double the capacity but in Vector if increment size is not specified it will double the size.
5.ArrayList is not legacy code but Vector is legacy code
6.In ArrayList we can use enhanced for loop ,iterator and ListIterator but In Vector we can use enhanced for loop ,iterator ,ListIterator and enumeration.
7.Array List is not thread safe but Vector is thread safe.
Note :ArrayList and Vector both extends AbstractList
implements List, RandomAccess, Cloneable, Serializable .because of RandomAccess implements for iteration and access values fast in nature
Java ArrayList and Vector both implements List interface and maintains insertion order. But there are some differences between ArrayList and Vector.
ReplyDeleteThread Safety (Synchronization)
Data growth
Performance
Traversing (Iterator)
Legacy
More....Arraylist Vs Vector