public static boolean areBooleanEquals ( Boolean boolean1 , Boolean boolean2 ) { if ( boolean1 != null && ! boolean1 . equals ( boolean2 ) ) { return false ; } else if ( boolean2 != null && ! boolean2 . equals ( boolean1 ) ) { return false ; } return true ; }
Checks if two Booleans are equals . The booleans can be both null one of them null or none of them null .