Woodstock Blog

a tech blog for general algorithmic interview questions

[Java OOP] Java Vector and ArrayList

Vector in Java

Vector class implements a growable array of objects.

It’s an array, not a list.

Vector VS ArrayList

  1. Vectors are synchronized, ArrayLists are not.
  2. Data Growth Methods (ArrayList grow by ½ of its size, while Vector doubles)

Usage: ALWAYS use ArrayLists

The vector was not the part of collection framework, it has been included in collections later. It can be considered as Legacy code.

There is nothing about Vector which List collection cannot do. Therefore Vector should be avoided.