ArraylistvsVector1.htm
  • java.util.Vector class was there since the very first version of the java development kit (jdk).
  • java.util.ArrayList was addded to java version 1.2, as part of Java Collections framework . In java version 1.2 , Vector class has been refactored to implement the List Inteface .
 

Vector

 ArrayList

Synchronized
  1. Yes
  2. The contents are thread safe
  3. Here Vector is slower
  1. NO
  2. The contents are not thread safe.
  3. Here ArrayList is Faster

Stretchable (capacity)

  • Both arranges the data internally and expands if run our of the room.
  • ArrayList ist set to 10 by default, reaching the last element , ArrayList would tender new array, then the old one would be subject to garbage collection. 
  1. increases by double or two fold
  2. For an unknown case, Vector is better logically.
  1. increases by 50 per cent
   

Adding in the middle

  • Both maintain data in ordered fashion,  positional indexes are added with the objects.
  • Both will take a toll, as the removal will increase or decrease the indices from the reference point of addition or removal respectively.
  • Both may affect the speed when accessing  elements in the middle.
  • Consider LinkedList for adding and removing elements very frequently.
Performance
  1. Vector slow safe thread
  1. in ArrayList two or more threads  can access the code at the same time
Enumeration
  1. Vector Like Hastable supports Enuumeration and Iterator
  1. ArrayList can only use iterator