This class tries to handle null input gracefully.
An exception will not be thrown for a null input.
Each method documents its behavior in more detail.
#ThreadSafe#
| Modifier and Type | Field and Description |
|---|---|
| private static final List | |
| public static final String | FALSE
The false String |
| public static final String | NO
The no String |
| public static final String | OFF
The off String |
| public static final String | ON
The on String |
| public static final String | TRUE
The true String |
| public static final String | YES
The yes String |
| Access | Constructor and Description |
|---|---|
| public | BooleanUtils()
Deprecated
TODO Make private in 4.0.
|
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | Returns: the result of the logical 'and' operation. That isfalse
if any of the parameters is false and true otherwise.an array of array)booleansPerforms an 'and' operation on a set of booleans. |
| public static Boolean | |
| public static Boolean[] | Returns: a new array of possible values (like an enum would).Returns a new array of possible values (like an enum would). |
| public static int | Returns: the value0 if x == y;
a value less than 0 if !x && y; and
a value greater than 0 if x && !ythe first x, final boolean boolean to comparethe second y)boolean to compareCompares two |
| public static void | forEach(final Consumer<Boolean>
The action to be performed for each element action)Performs the given action for each Boolean |
| public static boolean | |
| public static boolean | Returns: true if the input is null or truethe boolean to check, null returns bool)trueChecks if a |
| public static boolean | |
| public static boolean | |
| public static Boolean | |
| public static boolean | Returns: the result of the one-hot operationsan array of array)booleansPerforms a one-hot on an array of booleans. |
| public static Boolean | |
| public static boolean | Returns: true if any of the arguments is true, and it returns false otherwise.an array of array)booleansPerforms an 'or' operation on a set of booleans. |
| public static Boolean | |
| public static boolean[] | Returns: a new array of possible values (like an enum would).Returns a new array of possible values (like an enum would). |
| public static boolean | |
| public static boolean | Returns: true if non-zero, false
if zerothe int to convert value)Converts an int to a boolean using the convention that |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| public static boolean | Returns: the boolean value of the stringthe String to check str, final String the String to match for trueString, final String true (case-sensitive), may be nullthe String to match for falseString)false (case-sensitive), may be nullConverts a String to a Boolean throwing an exception if no match found. |
| public static boolean | Returns: true or falsethe boolean object to convert to primitive bool, final boolean the boolean value to return if the parameter valueIfNull)bool is nullConverts a Boolean to a boolean handling |
| public static Boolean | Returns: Boolean.TRUE if non-zero, Boolean.FALSE if zero,null if nullthe int to convert value)Converts an int to a Boolean using the convention that |
| public static Boolean | Returns: Boolean.TRUE, Boolean.FALSE, ornullthe Integer to convert value, final int the value to match for trueValue, final int truethe value to match for falseValue, final int falsethe value to match for nullValue)nullConverts an int to a Boolean specifying the conversion values. |
| public static Boolean | Returns: Boolean.TRUE if non-zero, Boolean.FALSE if zero,null if null inputthe Integer to convert value)Converts an Integer to a Boolean using the convention that |
| public static Boolean | Returns: Boolean.TRUE, Boolean.FALSE, ornullthe Integer to convert value, final Integer the value to match for trueValue, final Integer true, may be nullthe value to match for falseValue, final Integer false, may be nullthe value to match for nullValue)null, may be nullConverts an Integer to a Boolean specifying the conversion values. |
| public static Boolean | Returns: the Boolean value of the string,null if no match or null inputthe String to check; upper and lower case are treated as the same str)Converts a String to a Boolean. |
| public static Boolean | Returns: the Boolean value of the string,null if either the String matches nullString
or if null input and nullString is nullthe String to check str, final String the String to match for trueString, final String true (case-sensitive), may be nullthe String to match for falseString, final String false (case-sensitive), may be nullthe String to match for nullString)null (case-sensitive), may be nullConverts a String to a Boolean throwing an exception if no match. |
| public static int | Returns: one iftrue, zero if falsethe boolean to convert bool)Converts a boolean to an int using the convention that
|
| public static int | Returns: the appropriate valuethe to convert bool, final int the value to return if trueValue, final int truethe value to return if falseValue)falseConverts a boolean to an int specifying the conversion values. |
| public static int | |
| public static Integer | Returns: one iftrue, zero if falsethe boolean to convert bool)Converts a boolean to an Integer using the convention that
|
| public static Integer | Returns: the appropriate valuethe to convert bool, final Integer the value to return if trueValue, final Integer true, may be nullthe value to return if falseValue)false, may be nullConverts a boolean to an Integer specifying the conversion values. |
| public static Integer | Returns: one if Boolean.TRUE, zero if Boolean.FALSE,null if nullthe Boolean to convert bool)Converts a Boolean to an Integer using the convention that
|
| public static Integer | Returns: the appropriate valuethe Boolean to convert bool, final Integer the value to return if trueValue, final Integer true, may be nullthe value to return if falseValue, final Integer false, may be nullthe value to return if nullValue)null, may be nullConverts a Boolean to an Integer specifying the conversion values. |
| public static String | |
| public static String | Returns: one of the three input Stringsthe Boolean to check bool, final String the String to return if trueString, final String true, may be nullthe String to return if falseString, final String false, may be nullthe String to return if nullString)null, may be nullConverts a Boolean to a String returning one of the input Strings. |
| public static String | Returns: 'on', 'off', or nullthe Boolean to check bool)Converts a boolean to a String returning |
| public static String | Returns: 'on', 'off', or nullthe Boolean to check bool)Converts a Boolean to a String returning |
| public static String | Returns: 'true', 'false', or nullthe Boolean to check bool)Converts a boolean to a String returning |
| public static String | Returns: 'true', 'false', or nullthe Boolean to check bool)Converts a Boolean to a String returning |
| public static String | Returns: 'yes', 'no', or nullthe Boolean to check bool)Converts a boolean to a String returning |
| public static String | Returns: 'yes', 'no', or nullthe Boolean to check bool)Converts a Boolean to a String returning |
| public static List | Returns: an unmodifiable list of Booleans[false, true].Returns an unmodifiable list of Booleans |
| public static boolean | Returns: true if the number of true values in the array is odd; otherwise returns false.an array of array)booleansPerforms an xor on a set of booleans. |
| public static Boolean |
| BOOLEAN_LIST | back to summary |
|---|---|
| private static final List<Boolean> BOOLEAN_LIST | |
| FALSE | back to summary |
|---|---|
| public static final String FALSE The false String
| |
| NO | back to summary |
|---|---|
| public static final String NO The no String
| |
| OFF | back to summary |
|---|---|
| public static final String OFF The off String
| |
| ON | back to summary |
|---|---|
| public static final String ON The on String
| |
| TRUE | back to summary |
|---|---|
| public static final String TRUE The true String
| |
| YES | back to summary |
|---|---|
| public static final String YES The yes String
| |
| BooleanUtils | back to summary |
|---|---|
| public BooleanUtils()
Deprecated TODO Make private in 4.0.
This constructor is public to permit tools that require a JavaBean instance to operate.
| |
| and | back to summary |
|---|---|
| public static boolean and(final boolean... array) Performs an 'and' operation on a set of booleans. BooleanUtils.and(true, true) = true BooleanUtils.and(false, false) = false BooleanUtils.and(true, false) = false BooleanUtils.and(true, true, false) = false BooleanUtils.and(true, true, true) = true
| |
| and | back to summary |
|---|---|
| public static Boolean and(final Boolean... array) Performs an 'and' operation on an array of Booleans. BooleanUtils.and(Boolean.TRUE, Boolean.TRUE) = Boolean.TRUE BooleanUtils.and(Boolean.FALSE, Boolean.FALSE) = Boolean.FALSE BooleanUtils.and(Boolean.TRUE, Boolean.FALSE) = Boolean.FALSE BooleanUtils.and(Boolean.TRUE, Boolean.TRUE, Boolean.TRUE) = Boolean.TRUE BooleanUtils.and(Boolean.FALSE, Boolean.FALSE, Boolean.TRUE) = Boolean.FALSE BooleanUtils.and(Boolean.TRUE, Boolean.FALSE, Boolean.TRUE) = Boolean.FALSE BooleanUtils.and(null, null) = Boolean.FALSE
Null array elements map to false, like
| |
| booleanValues | back to summary |
|---|---|
| public static Boolean[] booleanValues() Returns a new array of possible values (like an enum would).
| |
| compare | back to summary |
|---|---|
| public static int compare(final boolean x, final boolean y) Compares two
| |
| forEach | back to summary |
|---|---|
| public static void forEach(final Consumer<Boolean> action) Performs the given action for each Boolean | |
| isFalse | back to summary |
|---|---|
| public static boolean isFalse(final Boolean bool) Checks if a BooleanUtils.isFalse(Boolean.TRUE) = false BooleanUtils.isFalse(Boolean.FALSE) = true BooleanUtils.isFalse(null) = false
| |
| isNotFalse | back to summary |
|---|---|
| public static boolean isNotFalse(final Boolean bool) Checks if a BooleanUtils.isNotFalse(Boolean.TRUE) = true BooleanUtils.isNotFalse(Boolean.FALSE) = false BooleanUtils.isNotFalse(null) = true
| |
| isNotTrue | back to summary |
|---|---|
| public static boolean isNotTrue(final Boolean bool) Checks if a BooleanUtils.isNotTrue(Boolean.TRUE) = false BooleanUtils.isNotTrue(Boolean.FALSE) = true BooleanUtils.isNotTrue(null) = true
| |
| isTrue | back to summary |
|---|---|
| public static boolean isTrue(final Boolean bool) Checks if a BooleanUtils.isTrue(Boolean.TRUE) = true BooleanUtils.isTrue(Boolean.FALSE) = false BooleanUtils.isTrue(null) = false
| |
| negate | back to summary |
|---|---|
| public static Boolean negate(final Boolean bool) Negates the specified boolean. If Note This returns BooleanUtils.negate(Boolean.TRUE) = Boolean.FALSE; BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE; BooleanUtils.negate(null) = null; | |
| oneHot | back to summary |
|---|---|
| public static boolean oneHot(final boolean... array) Performs a one-hot on an array of booleans. This implementation returns true if one, and only one, of the supplied values is true. See also One-hot.
| |
| oneHot | back to summary |
|---|---|
| public static Boolean oneHot(final Boolean... array) Performs a one-hot on an array of booleans. This implementation returns true if one, and only one, of the supplied values is true.
Null array elements map to false, like See also One-hot.
| |
| or | back to summary |
|---|---|
| public static boolean or(final boolean... array) Performs an 'or' operation on a set of booleans. BooleanUtils.or(true, true) = true BooleanUtils.or(false, false) = false BooleanUtils.or(true, false) = true BooleanUtils.or(true, true, false) = true BooleanUtils.or(true, true, true) = true BooleanUtils.or(false, false, false) = false
| |
| or | back to summary |
|---|---|
| public static Boolean or(final Boolean... array) Performs an 'or' operation on an array of Booleans. BooleanUtils.or(Boolean.TRUE, Boolean.TRUE) = Boolean.TRUE BooleanUtils.or(Boolean.FALSE, Boolean.FALSE) = Boolean.FALSE BooleanUtils.or(Boolean.TRUE, Boolean.FALSE) = Boolean.TRUE BooleanUtils.or(Boolean.TRUE, Boolean.TRUE, Boolean.TRUE) = Boolean.TRUE BooleanUtils.or(Boolean.FALSE, Boolean.FALSE, Boolean.TRUE) = Boolean.TRUE BooleanUtils.or(Boolean.TRUE, Boolean.FALSE, Boolean.TRUE) = Boolean.TRUE BooleanUtils.or(Boolean.FALSE, Boolean.FALSE, Boolean.FALSE) = Boolean.FALSE BooleanUtils.or(Boolean.TRUE, null) = Boolean.TRUE BooleanUtils.or(Boolean.FALSE, null) = Boolean.FALSE
Null array elements map to false, like
| |
| primitiveValues | back to summary |
|---|---|
| public static boolean[] primitiveValues() Returns a new array of possible values (like an enum would).
| |
| toBoolean | back to summary |
|---|---|
| public static boolean toBoolean(final Boolean bool) Converts a Boolean to a boolean handling BooleanUtils.toBoolean(Boolean.TRUE) = true BooleanUtils.toBoolean(Boolean.FALSE) = false BooleanUtils.toBoolean(null) = false
| |
| toBoolean | back to summary |
|---|---|
| public static boolean toBoolean(final int value) Converts an int to a boolean using the convention that BooleanUtils.toBoolean(0) = false BooleanUtils.toBoolean(1) = true BooleanUtils.toBoolean(2) = true
| |
| toBoolean | back to summary |
|---|---|
| public static boolean toBoolean(final int value, final int trueValue, final int falseValue) Converts an int to a boolean specifying the conversion values. If the BooleanUtils.toBoolean(0, 1, 0) = false BooleanUtils.toBoolean(1, 1, 0) = true BooleanUtils.toBoolean(1, 1, 1) = true BooleanUtils.toBoolean(2, 1, 2) = false BooleanUtils.toBoolean(2, 2, 0) = true
| |
| toBoolean | back to summary |
|---|---|
| public static boolean toBoolean(final Integer value, final Integer trueValue, final Integer falseValue) Converts an Integer to a boolean specifying the conversion values. BooleanUtils.toBoolean(Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(0)) = false BooleanUtils.toBoolean(Integer.valueOf(1), Integer.valueOf(1), Integer.valueOf(0)) = true BooleanUtils.toBoolean(Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(2)) = false BooleanUtils.toBoolean(Integer.valueOf(2), Integer.valueOf(2), Integer.valueOf(0)) = true BooleanUtils.toBoolean(null, null, Integer.valueOf(0)) = true
| |
| toBoolean | back to summary |
|---|---|
| public static boolean toBoolean(final String str) Converts a String to a boolean (optimized for performance).
This method performs 4 times faster (JDK1.4) than
BooleanUtils.toBoolean(null) = false
BooleanUtils.toBoolean("true") = true
BooleanUtils.toBoolean("TRUE") = true
BooleanUtils.toBoolean("tRUe") = true
BooleanUtils.toBoolean("on") = true
BooleanUtils.toBoolean("yes") = true
BooleanUtils.toBoolean("false") = false
BooleanUtils.toBoolean("x gti") = false
BooleanUtils.toBoolean("y") = true
BooleanUtils.toBoolean("n") = false
BooleanUtils.toBoolean("t") = true
BooleanUtils.toBoolean("f") = false
| |
| toBoolean | back to summary |
|---|---|
| public static boolean toBoolean(final String str, final String trueString, final String falseString) Converts a String to a Boolean throwing an exception if no match found.
BooleanUtils.toBoolean("true", "true", "false") = true
BooleanUtils.toBoolean("false", "true", "false") = false
| |
| toBooleanDefaultIfNull | back to summary |
|---|---|
| public static boolean toBooleanDefaultIfNull(final Boolean bool, final boolean valueIfNull) Converts a Boolean to a boolean handling BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, false) = true BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, true) = true BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, true) = false BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, false) = false BooleanUtils.toBooleanDefaultIfNull(null, true) = true BooleanUtils.toBooleanDefaultIfNull(null, false) = false
| |
| toBooleanObject | back to summary |
|---|---|
| public static Boolean toBooleanObject(final int value) Converts an int to a Boolean using the convention that BooleanUtils.toBoolean(0) = Boolean.FALSE BooleanUtils.toBoolean(1) = Boolean.TRUE BooleanUtils.toBoolean(2) = Boolean.TRUE
| |
| toBooleanObject | back to summary |
|---|---|
| public static Boolean toBooleanObject(final int value, final int trueValue, final int falseValue, final int nullValue) Converts an int to a Boolean specifying the conversion values. Note This method may return The checks are done first for the BooleanUtils.toBooleanObject(0, 0, 2, 3) = Boolean.TRUE BooleanUtils.toBooleanObject(0, 0, 0, 3) = Boolean.TRUE BooleanUtils.toBooleanObject(0, 0, 0, 0) = Boolean.TRUE BooleanUtils.toBooleanObject(2, 1, 2, 3) = Boolean.FALSE BooleanUtils.toBooleanObject(2, 1, 2, 2) = Boolean.FALSE BooleanUtils.toBooleanObject(3, 1, 2, 3) = null
| |
| toBooleanObject | back to summary |
|---|---|
| public static Boolean toBooleanObject(final Integer value) Converts an Integer to a Boolean using the convention that
Note This method may return BooleanUtils.toBooleanObject(Integer.valueOf(0)) = Boolean.FALSE BooleanUtils.toBooleanObject(Integer.valueOf(1)) = Boolean.TRUE BooleanUtils.toBooleanObject(Integer.valueOf(null)) = null | |
| toBooleanObject | back to summary |
|---|---|
| public static Boolean toBooleanObject(final Integer value, final Integer trueValue, final Integer falseValue, final Integer nullValue) Converts an Integer to a Boolean specifying the conversion values. Note This method may return The checks are done first for the BooleanUtils.toBooleanObject(Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(2), Integer.valueOf(3)) = Boolean.TRUE BooleanUtils.toBooleanObject(Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(3)) = Boolean.TRUE BooleanUtils.toBooleanObject(Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)) = Boolean.TRUE BooleanUtils.toBooleanObject(Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)) = Boolean.FALSE BooleanUtils.toBooleanObject(Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(2)) = Boolean.FALSE BooleanUtils.toBooleanObject(Integer.valueOf(3), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)) = null
| |
| toBooleanObject | back to summary |
|---|---|
| public static Boolean toBooleanObject(final String str) Converts a String to a Boolean.
Note This method may return
// Case is not significant
BooleanUtils.toBooleanObject(null) = null
BooleanUtils.toBooleanObject("true") = Boolean.TRUE
BooleanUtils.toBooleanObject("T") = Boolean.TRUE // i.e. T[RUE]
BooleanUtils.toBooleanObject("false") = Boolean.FALSE
BooleanUtils.toBooleanObject("f") = Boolean.FALSE // i.e. f[alse]
BooleanUtils.toBooleanObject("No") = Boolean.FALSE
BooleanUtils.toBooleanObject("n") = Boolean.FALSE // i.e. n[o]
BooleanUtils.toBooleanObject("on") = Boolean.TRUE
BooleanUtils.toBooleanObject("ON") = Boolean.TRUE
BooleanUtils.toBooleanObject("off") = Boolean.FALSE
BooleanUtils.toBooleanObject("oFf") = Boolean.FALSE
BooleanUtils.toBooleanObject("yes") = Boolean.TRUE
BooleanUtils.toBooleanObject("Y") = Boolean.TRUE // i.e. Y[ES]
BooleanUtils.toBooleanObject("1") = Boolean.TRUE
BooleanUtils.toBooleanObject("0") = Boolean.FALSE
BooleanUtils.toBooleanObject("blue") = null
BooleanUtils.toBooleanObject("true ") = null // trailing space (too long)
BooleanUtils.toBooleanObject("ono") = null // does not match on or no
| |
| toBooleanObject | back to summary |
|---|---|
| public static Boolean toBooleanObject(final String str, final String trueString, final String falseString, final String nullString) Converts a String to a Boolean throwing an exception if no match. Note This method may return
BooleanUtils.toBooleanObject("true", "true", "false", "null") = Boolean.TRUE
BooleanUtils.toBooleanObject(null, null, "false", "null") = Boolean.TRUE
BooleanUtils.toBooleanObject(null, null, null, "null") = Boolean.TRUE
BooleanUtils.toBooleanObject(null, null, null, null) = Boolean.TRUE
BooleanUtils.toBooleanObject("false", "true", "false", "null") = Boolean.FALSE
BooleanUtils.toBooleanObject("false", "true", "false", "false") = Boolean.FALSE
BooleanUtils.toBooleanObject(null, "true", null, "false") = Boolean.FALSE
BooleanUtils.toBooleanObject(null, "true", null, null) = Boolean.FALSE
BooleanUtils.toBooleanObject("null", "true", "false", "null") = null
| |
| toInteger | back to summary |
|---|---|
| public static int toInteger(final boolean bool) Converts a boolean to an int using the convention that
BooleanUtils.toInteger(true) = 1 BooleanUtils.toInteger(false) = 0
| |
| toInteger | back to summary |
|---|---|
| public static int toInteger(final boolean bool, final int trueValue, final int falseValue) Converts a boolean to an int specifying the conversion values. BooleanUtils.toInteger(true, 1, 0) = 1 BooleanUtils.toInteger(false, 1, 0) = 0
| |
| toInteger | back to summary |
|---|---|
| public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) Converts a Boolean to an int specifying the conversion values. BooleanUtils.toInteger(Boolean.TRUE, 1, 0, 2) = 1 BooleanUtils.toInteger(Boolean.FALSE, 1, 0, 2) = 0 BooleanUtils.toInteger(null, 1, 0, 2) = 2
| |
| toIntegerObject | back to summary |
|---|---|
| public static Integer toIntegerObject(final boolean bool) Converts a boolean to an Integer using the convention that
BooleanUtils.toIntegerObject(true) = Integer.valueOf(1) BooleanUtils.toIntegerObject(false) = Integer.valueOf(0)
| |
| toIntegerObject | back to summary |
|---|---|
| public static Integer toIntegerObject(final boolean bool, final Integer trueValue, final Integer falseValue) Converts a boolean to an Integer specifying the conversion values. BooleanUtils.toIntegerObject(true, Integer.valueOf(1), Integer.valueOf(0)) = Integer.valueOf(1) BooleanUtils.toIntegerObject(false, Integer.valueOf(1), Integer.valueOf(0)) = Integer.valueOf(0) | |
| toIntegerObject | back to summary |
|---|---|
| public static Integer toIntegerObject(final Boolean bool) Converts a Boolean to an Integer using the convention that
BooleanUtils.toIntegerObject(Boolean.TRUE) = Integer.valueOf(1) BooleanUtils.toIntegerObject(Boolean.FALSE) = Integer.valueOf(0) | |
| toIntegerObject | back to summary |
|---|---|
| public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) Converts a Boolean to an Integer specifying the conversion values. BooleanUtils.toIntegerObject(Boolean.TRUE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(1) BooleanUtils.toIntegerObject(Boolean.FALSE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(0) BooleanUtils.toIntegerObject(null, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(2) | |
| toString | back to summary |
|---|---|
| public static String toString(final boolean bool, final String trueString, final String falseString) Converts a boolean to a String returning one of the input Strings. BooleanUtils.toString(true, "true", "false") = "true" BooleanUtils.toString(false, "true", "false") = "false" | |
| toString | back to summary |
|---|---|
| public static String toString(final Boolean bool, final String trueString, final String falseString, final String nullString) Converts a Boolean to a String returning one of the input Strings. BooleanUtils.toString(Boolean.TRUE, "true", "false", null) = "true" BooleanUtils.toString(Boolean.FALSE, "true", "false", null) = "false" BooleanUtils.toString(null, "true", "false", null) = null; | |
| toStringOnOff | back to summary |
|---|---|
| public static String toStringOnOff(final boolean bool) Converts a boolean to a String returning BooleanUtils.toStringOnOff(true) = "on" BooleanUtils.toStringOnOff(false) = "off"
| |
| toStringOnOff | back to summary |
|---|---|
| public static String toStringOnOff(final Boolean bool) Converts a Boolean to a String returning BooleanUtils.toStringOnOff(Boolean.TRUE) = "on" BooleanUtils.toStringOnOff(Boolean.FALSE) = "off" BooleanUtils.toStringOnOff(null) = null; | |
| toStringTrueFalse | back to summary |
|---|---|
| public static String toStringTrueFalse(final boolean bool) Converts a boolean to a String returning BooleanUtils.toStringTrueFalse(true) = "true" BooleanUtils.toStringTrueFalse(false) = "false"
| |
| toStringTrueFalse | back to summary |
|---|---|
| public static String toStringTrueFalse(final Boolean bool) Converts a Boolean to a String returning BooleanUtils.toStringTrueFalse(Boolean.TRUE) = "true" BooleanUtils.toStringTrueFalse(Boolean.FALSE) = "false" BooleanUtils.toStringTrueFalse(null) = null; | |
| toStringYesNo | back to summary |
|---|---|
| public static String toStringYesNo(final boolean bool) Converts a boolean to a String returning BooleanUtils.toStringYesNo(true) = "yes" BooleanUtils.toStringYesNo(false) = "no"
| |
| toStringYesNo | back to summary |
|---|---|
| public static String toStringYesNo(final Boolean bool) Converts a Boolean to a String returning BooleanUtils.toStringYesNo(Boolean.TRUE) = "yes" BooleanUtils.toStringYesNo(Boolean.FALSE) = "no" BooleanUtils.toStringYesNo(null) = null; | |
| values | back to summary |
|---|---|
| public static List Returns an unmodifiable list of Booleans | |
| xor | back to summary |
|---|---|
| public static boolean xor(final boolean... array) Performs an xor on a set of booleans. This behaves like an XOR gate; it returns true if the number of true values is odd, and false if the number of true values is zero or even. BooleanUtils.xor(true, true) = false BooleanUtils.xor(false, false) = false BooleanUtils.xor(true, false) = true BooleanUtils.xor(true, false, false) = true BooleanUtils.xor(true, true, true) = true BooleanUtils.xor(true, true, true, true) = false
| |
| xor | back to summary |
|---|---|
| public static Boolean xor(final Boolean... array) Performs an xor on an array of Booleans. BooleanUtils.xor(Boolean.TRUE, Boolean.TRUE) = Boolean.FALSE BooleanUtils.xor(Boolean.FALSE, Boolean.FALSE) = Boolean.FALSE BooleanUtils.xor(Boolean.TRUE, Boolean.FALSE) = Boolean.TRUE BooleanUtils.xor(Boolean.TRUE, Boolean.FALSE, Boolean.FALSE) = Boolean.TRUE BooleanUtils.xor(Boolean.FALSE, null) = Boolean.FALSE BooleanUtils.xor(Boolean.TRUE, null) = Boolean.TRUE
Null array elements map to false, like
| |