ArrayList vs Vector

ArrayList vs Vector

Vector is legacy class which is available with Java before collection framework comes into picture while ArrayList was introduce with collection framework. There are some basic differences between ArrayList and Vector as well as few similarities. It is very common to ask question around ArrayList and Vector in interviews. Also if we know the differences and similarities between ArrayList and Vector, it will be easier for us to select one of these while writing our code.

Differences between ArrayList and Vector.

[table “” not found /]

Similarities between ArrayList and Vector.

  1. Both ArrayList and Vector are derived from AbstractList and implements List interface, which means both of them are ordered collection and allows duplicates.
  2. ArrayList and Vector are index based Collection and we can use get(index) method to retrieve objects.
You can find more about ArrayList here and Vector here.

Other Interview questions.


Leave a Reply

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