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 use peek to do that.
peek
List newList = fruits.stream() .peek(f -> f.setName(f.getName() + "s")) .collect(Collectors.toList());