Home Java SCJP SCWCD Servlet Submit News Contact Us Site Map


Over 500 magazines for free (including Oracle Magazine)!

Yes all of them are FREE. You can subscribe to ALL of them.
Click here to apply today!

Home > Java > Java Articles

Difference between Java Vector and Java ArrayList

ArrayList and Vector are very similar to each other. Difference between ArrayList and Vector is as given below

1) ArrayList is not synchronized, while Vector is synchronized.
Vector is synchronized, so its thread safe, ArrayList is not thread safe. So if multiple threads are supposed to manipulate the contents of the list, Vector should be used instead of the ArrayList.

On the other hand, synchronization causes the performance penalty. So if thread safe collection is not needed then ArrayList should be used instead of the Vector.


2) ArrayList and Vector both are resizable array, and internally uses the array to hold elements of the list. Capacity of the ArrayList or Vector is the actual size of the array used to store the list elements. Capacity of the ArrayList or Vector grows automatically as we add elements to it. By default Vector doubles the capacity when needed, while ArrayList increases the capacity by half.

Home Java SCJP SCWCD Servlet Site map