JAVA – Difference between ArrayList and Vector


ArrayList :

  • No method is synchronized.
  • Multiple threads can access ArrayList simultaneously. Hence Array List object is not thread safe.
  • Threads are not required to wait, Hence, performance is high
  • Introduced in 1.2 version & Hence it is non Legacy

Vector:

  • Every method is synchronized.
  • At any point only one thread is allowed to operate on vector object at a time. Hence vector object is thread safe.
  • It increases waiting time of threads. Hence performance is low.
  • Introduced in 1.0 version. Hence it is Legacy.

 

Leave a Reply

Your email address will not be published. Required fields are marked *