List Interface replaceAll() method In Java 8

replaceAll() method on the List Interface has been added in Java 8. This method takes a function as a parameter, which a special type function called UnaryOperator, that takes an element from that list and return another element of the same type, and then all the element of that list will be processed by that operator one by one.

Let see an example of List Interface new replaceAll() method:

So here will be result, printing all elements of list in UpperCase:

 

Leave a Reply

Your email address will not be published. Required fields are marked *