@ SuppressWarnings ( "all" ) @ NullSafe public static boolean and ( Boolean ... values ) { boolean result = ( values != null ) ; // innocent until proven guilty if ( result ) { for ( Boolean value : values ) { result &= valueOf ( value ) ; if ( ! result ) { // short-circuit if we find a false value break ; } } } return result ; }
Performs a logical AND on all the Boolean values and returns true if an only if all Boolean values evaluate to true as determined by the BooleanUtils . valueOf method on the Boolean wrapper object . If the Boolean array is null then the result of the AND operation is false .