What is the Vector class?The capability of implementing a growable array of objects is provided by the class Vector.
A Vector class implements the dynamic array that can grow and shrink at run time (dynamically). It resembles the implementation of ArrayList with a difference that Vector is synchronized.
The Vector class implements an incremental array of objects. The vector components can be accessed using an integer index. The size of a Vector increases or decreases as needed to accommodate the items.
To reduce the amount of incremental reallocation, an application can increase the capacity of a vector before inserting a large number of components.
Each vector tries to optimize storage management by maintaining a capacity and a capacityIncrement. As components are added to a vector, the vector's storage increases in chunks the size of capacityIncrement.
|