Java Vector replaceAll() Method
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.
Following is the declaration of replaceAll() method:
The replaceAll() method does not return anything.
NullPointerException- 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.
Java 1.2 and above
Example 1Test it Now
Vector elements: [10, 2, 30, 40, 2] New vector elements: [10, 20, 30, 40, 20]
Example 2Test it Now
Vector elements: [Java, Python, Android, Java, Ruby] New vector elements: [JavaTpoint, Python, Android, JavaTpoint, Ruby]