|
Answer» The list interface in Java can be maintained using both ARRAYLIST and Vector and both of them use dynamically resizable arrays as their internal DATA structure. So, the major DIFFERENCES between these are given as follows: ArrayList
| Vector
|
|---|
The ArrayList is not SYNCHRONIZED i.e. many threads can work on the ArrayList at the same time.
| Vector is synchronized i.e. only one thread can access the Vector at a time.
| The ArrayList is fast as compared to vector since it is not synchronized.
| The Vector is slow as compared to ArrayList since it is synchronized.
| If the number of ELEMENTS exceed the capacity of the ArrayList, then it increases its current array size by 50%.
| If the number of elements exceed the capacity of the Vector, then it doubles its current array size.
| The traversal of elements in ArrayList is done using Iterator interface only.
| The traversal of elements in Vector is done using Enumeration and Iterator interface.
| The ArrayList is not a legacy class.
| The Vector is a legacy class.
|
|