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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -