I have a boolean array in java:
boolean[] myArray = new boolean[10];
What's the most elegant way to check if all the values are true?
public static boolean areAllTrue(boolean[] array) { for(boolean b : array) if(!b) return false; return true; }
2.1m questions
2.1m answers
60 comments
57.0k users