Java Vector replaceAll() Method24 Mar 2025 | 2 min read The replaceAll() method of Java Vector class is used to replace each element of the list with the result of applying the operator to that element. SyntaxFollowing is the declaration of replaceAll() method: Parameter
ReturnThe replaceAll() method does not return anything. ExceptionsNullPointerException- This method has thrown an exception if the specified operator is null or if the operator result is a null value and this list does not permit null elements. Compatibility VersionJava 1.2 and above Example 1Output: Vector elements: [10, 2, 30, 40, 2] New vector elements: [10, 20, 30, 40, 20] Example 2Output: Vector elements: [Java, Python, Android, Java, Ruby] New vector elements: [tpointtech, Python, Android, tpointtech, Ruby] 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 remove() Java Vector class method is used to remove the specified element from the vector. There are two different types of Java remove() method which can be differentiated depending on its parameter. These are: Java Vector remove(int index) Method Java Vector remove(Object o) Method remove(int...
3 min read
Java Method The retainAll() method of Java Vector class is used to retain only that elements in the vector which are contained in the specified collection. In other words, it removes all elements from this vector that are not contained in the specified collection. Syntax Following is...
3 min read
Java Method The iterator() method of Java Vector class is used to get an iterator over the elements in this list in proper sequence. Syntax Following is the declaration of an iterator() method: Public Iterator<E> iterator() Parameter This method does not accept any parameter. Return The iterator() method returns an iterator over...
2 min read
Java Method The removeRange() method of Java Vector class is used to delete all elements from the vector whose index is between fromIndex, inclusive and toIndex, exclusive. The removal of elements shifts any succeeding elements to the left (reduces their index). Syntax Following is the declaration of...
2 min read
Java Method The firstElement() method of Java Vector class is used to get the first element ( at index 0 ) of the vector which is in use. Syntax: Following is the declaration of firstElement() method: public E firstElement() Parameter: This method does not accept any parameter. Returns: The firstElement() method returns...
2 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 insertElementAt() method of Java Vector class is used to insert the specified object as a component in this vector at the specified index. Each component in the vector with an index greater or equal to the given index is shifted upward. Now,...
3 min read
Java Method 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: public...
2 min read
Java Method The listIterator() Java Vector class method returns a list iterator over the elements in the given list in a proper sequence. There is two different types of Java listIterator() method which can be differentiated depending on its parameter. These are: Java Method Java Vector...
4 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