ArrayList and Vector both implements List interface and maintains insertion order.
There are many differences between ArrayList and Vector classes that are stated below.
ArrayList | Vector |
---|---|
ArrayList is not synchronized. | Vector is synchronized. |
ArrayList increments 50% of current array size if the number of elements exceeds from its capacity. | Vector increments 100% means doubles the array size if the total number of elements exceeds than its capacity. |
ArrayList is not a legacy class. It is introduced in JDK 1.2. | Vector is a legacy class. |
ArrayList is fast because it is non-synchronized. | Vector is slow because it is synchronized, i.e., in a multithreading environment, it holds the other threads in runnable or non-runnable state until current thread releases the lock of the object. |
ArrayList uses the Iterator interface to traverse the elements. | A Vector can use the Iterator interface or Enumeration interface to traverse the elements. |