Java Vector elements() Method24 Mar 2025 | 1 min read The elements() method of Java Vector class used to get an enumeration of the elements of the vector which is in use. The returned enumeration object will generate all items in this vector at the same location. Syntax:Following is the declaration of elements() method: Parameter:This method does not accept any parameter. Returns:The elements() method returns an enumeration of the elements of this vector. Exceptions:NA Compatibility Version:Java 1.2 and above Example 1:Output: Data in enumeration object is: Element: 11 Element: 22 Element: 33 Example 2:Output: Data in enumeration object is: White Green Black Pink Next TopicJava Vector |
Java Method The containsAll() method of Java Vector class is used to check the vector which is in use contains all of the elements in the specified Collection or not. It returns true if this vector contains all of the elements in the Collection, otherwise...
3 min read
Java Method The contains() method of Java Vector class is used to check the vector which is in use contains the specified element or not. It returns true if this vector contains the specified element, otherwise returns false. Syntax: Following is the declaration of contains() method: public boolean...
2 min read
Java Method The set() method of Java Vector class is used to replace the element at the specified position in the vector with the specified element. Syntax Following is the declaration of set() method: Public E set(int index, E element) Parameter Parameter Description Required/Optional index It is an index of the element which will...
2 min read
Java Method The setSize() method of Java Vector class is used to set the size of a vector. If the new size is greater than the current size, null items are added to the end of the vector. Otherwise, all components at index newSize and...
3 min read
Java Method The copyInto() method of Java Vector class used to copy the elements of the vector which is in use into the specified array. In this, the position of the elements is the same in both the vector and an array. Syntax: Following is the declaration...
3 min read
Java Method The removeElement() method of Java Vector class is used to remove the first (lowest-indexed) occurrence of the argument from this vector. Removing an element decreases the vector size by one. Syntax Following is the declaration of removeElement() method: Public boolean removeElement(Object obj) Parameter Parameter Description Required/Optional obj It is an element which...
2 min read
Java Method The indexOf() Java Vector class method is used to get the index of the first occurrence of the specified element in the vector. There are two different types of Java indexOf() method which can be differentiated depending on its parameter. These are: Java Vector...
3 min read
Java Method The addAll() Java Vector class method inserts all of the elements in the specified collection to the end of the vector which is in use. The order of the elements will be the same as they are returned by the specified collection's iterator....
5 min read
Java Method The forEach() method of Java Vector class is used to perform the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration if that order...
2 min read
Java Method The size() method of Java Vector class is used to get the number of components presents in the vector. Syntax Following is the declaration of size() method: public int size() Parameter This method does not accept any parameter. Return The size() method returns the number of components presents in a...
2 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India