ArrayList and Vector both implements List interface and maintains insertion order. Differences between ArrayList and Vector classes that are given below.

ArrayListVector
ArrayList is not synchronized.Vector is synchronized.
ArrayList increments 50% of current array size if number of element exceeds from its capacity.Vector increments 100% means doubles the array size if total number of element exceeds than its capacity.
ArrayList is fast because it is non-synchronized.Vector is slow because it is synchronized i.e. in multithreading environment, it will hold the other threads in runnable or non-runnable state until current thread releases the lock of object.
ArrayList uses Iterator interface to traverse the elements.Vector uses Enumeration interface to traverse the elements. But it can use Iterator also.

 


Example

import java.util.*; 
class TestVector1{ 
 public static void main(String args[]){ 
 
 // Creating vector 
 Vector<String> v=new Vector<String>();
 v.add("umesh");
  
 // Traversing elements using Enumeration 
 Enumeration e=v.elements(); 
 while(e.hasMoreElements()){ 
   System.out.println(e.nextElement()); 
 } 
 } 
}