Increment every number in a list by 1.
import public |
The replaceAll() method substitutes each item in a list with the outcome of a specified operation on that item. This operation can be defined using a lambda expression that conforms to Java’s UnaryOperator interface.
For further understanding of lambda expressions, refer to our Java Lambda Expression tutorial.
public |
Parameter |
Description |
operator |
Necessary: A UnaryOperator or lambda expression that acts on each item in the list. |