Java Program to Iterate Vector using Enumeration
The Vector class implements a growable array of objects. It is available in java.util package. It implements the List interface. The Enumeration interface defines the methods by which you can traverse the elements in a collection of objects. Now in order to add elements
public class Vector<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable
java.util.Enumeration interface is one of the predefined interfaces, whose object is used for retrieving the data from collections framework variable( like Stack, Vector, HashTable, etc.) in a forward direction only and not in the backward direction.
You can use the Java.util.Vector.addElement() method to append a specified element to the end of this vector by increasing the size of the vector by 1. The functionality of this method is similar to that of the add() method of the Vector class.
boolean addElement(Object element)
Parameters: This function accepts a single parameter element of object type and refers to the element specified by this parameter is appended to the end of the vector.
Return Value: This is a void type method and does not return any value.
Welcome To Geeks for Geeks
1 2 3 4
Please Login to comment...