Repeat Stream allMatch() until true

Viewed 591
int testValue;
boolean success = false;

while(success == false) {
 testValue = generateRandomInt();   
 success = mySystem.getHosts().parallelStream().allMatch(predicate(testValue));
}

return testValue;

I am playing around with java8 streams. What do you suggest to make the code above more elegant/readable?

2 Answers
Related