Javatpoint Logo
Javatpoint Logo

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:


Parameter Description Required/Optional
operator It is an operator which will apply to each element. Required


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.

Compatibility Version

Java 1.2 and above

Example 1

Test it Now


Vector elements: [10, 2, 30, 40, 2]
New vector elements: [10, 20, 30, 40, 20]

Example 2

Test it Now


Vector elements: [Java, Python, Android, Java, Ruby]
New vector elements: [JavaTpoint, Python, Android, JavaTpoint, Ruby]

Next TopicJava Vector

Youtube For Videos Join Our Youtube Channel: Join Now


  • Send your Feedback to

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA