I have a list of Fruit objects in ArrayList and I want to modify fruitName to its plural name.
Fruit
fruitName
Refer the example:
@Data @Al
You can do it using streams map function like below, get result in new stream for further processing.
Stream newFruits = fruits.stream().map(fruit -> {fruit.name+="s"; return fruit;}); newFruits.forEach(fruit->{ System.out.println(fruit.name); });