I want to achieve something like this:
items.stream()
.filter(s-> s.contains("B"))
.forEach(s-> s.setState("ok"))
.collect(Collectors.toList());
filter, then change a property from the filtered result, then collect the result to a list. However, the debugger says:
Cannot invoke
collect(Collectors.toList())
on the primitive typevoid
.
Do I need 2 streams for that?