Introduction of Java Vector
Vector is a legacy class that represents a dynamic array. This class existed before Collection framework and is modified after the introduction of Collection framework to make a compatible to the Collection framework.
Commonly used methods of Vector
1.addElement(): It is used to add an element to a Vector.
2.removeElement():It is used to remove element from Vector.
3.capacity():It returns the capacity of a Vector.
4.ensureCapacity(): It is used to increase the capacity of a Vector.
5.elements(): It is used to obtain Enumeration for traversing the Vector elements.
Enumeration is legacy interface that is used by collection to facilitate traversing there objects in implementation independent manner.
Methods of Enumeration Interface
1.hasMoreElements(): It is used to find out whether an element is collection or not.
2.nextElement(): It is used to obtain reference of next element of an collection.
Example Of Vector