com.redhat.ceylon.common.BooleanUtil Maven / Gradle / Ivy
package com.redhat.ceylon.common;
/**
* Believe it or not, but auto-boxing returns instances of Boolean which are not == Boolean.TRUE
* so we need something smarter :(
*
* @author Stéphane Épardaud
*/
public class BooleanUtil {
/**
* @return true if b is not null and is true
*/
public static boolean isTrue(Boolean b){
return b != null && b.booleanValue();
}
/**
* @return true if b is not null and is false
*/
public static boolean isFalse(Boolean b){
return b != null && !b.booleanValue();
}
/**
* @return true if b is null or is true
*/
public static boolean isNotFalse(Boolean b){
return b == null || b.booleanValue();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy