If you have org.apache.commons in your dependencies, you can use a class from a mutable package:
org.apache.commons.lang3.mutable.MutableBoolean
You can then change this value inside your anonymous functions (lambdas) as follows:
List<YourClass> someList = new ArrayList<>();
MutableBoolean result = new MutableBoolean(true);
someList.stream().map(YourClass::getBooleanMember).forEach(b -> result.setValue(result.getValue() && b));
If you do not have this dependency, you can create your own shell.
source
share