Skip to content
Advertisement

Java 8 edit stream elements

I need to filter and modify the values of the filtered object. The logic that must be filtered is given below.

JavaScript

I have tried it like this. But how can we set the value of isUpdated = true using java 8?

JavaScript

Advertisement

Answer

Base on the logic given, findFirst should be used as you stop after the first instance is found.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement