What is difference between Arraylist and Vector in java?

(Last Updated On: March 11, 2018)

Difference between Arraylist and Vector in java in Java Collections. We will be listing four important difference between java arraylist and vector data structures. Note that two differences that thread safety and performance difference should be given extra focus.

Java ArrayList Vs Vector

  • ArrayList is not thread safe as its methods are not synchronized, whereas Vector’s methods are synchronized. So, in multithreading environment, we can use Vector without making any extra efforts of synchronization as we do with ArrayList shared by multiple threads.

                     ArrayList: public boolean add(E e)

                     Vector : public synchronized void addElement(E obj)

  • ArrayList is faster than Vector as it includes a slight overhead due to synchronization.
  • ArrayList increments 50% of current array size if number of element exceeds its capacity while Vector increments 100% i.e. double.
  • Size increment can be fixed in Vector but not in an ArrayList. For example, if we want to allow vector to re-size by some number we can do so using Vector constructor. This way it will not increments size by 100%. An example below.


Java code example with comments for increasing size of Vector:


Intial Capacity is 5
Capacity After default increment 10
Intial Capacity is 5
Capacity After fixed increment 7