java - Short circuit logical operators over Iterable -
consider following code, loop can finish hits false
value. there better way checking false
after each iteration?
boolean result = true; list<boolean> blist = new arraylist<>(); (boolean b : blist) { result = result && b; if (!result) { break; } }
what about
if (blist.contains(false)) { ...
Comments
Post a Comment