Suule :
I am trying to make myself more comfortable with Java 8 Stream api. Currently I want to translate something like as stream, but it seems I am still not comfortable enough, because I have no idea how to do this.
boolean isTrue = false;
for (Integer integer : intList) {
if (integer > 10) {
isTrue = true;
break;
}
}
Eugene :
All you care about is if at least one input from your list is bigger than 10, thus anyMatch
:
boolean isTrue = intList.stream()
.anyMatch(x -> x > 10);