Java Utililty Methods Boolean Value From

List of utility methods to do Boolean Value From

Description

The list of methods to do Boolean Value From are organized into topic(s).

Method

booleanbooleanValue(String s)
boolean Value
boolean rv = false;
if (s != null && s.equalsIgnoreCase("true"))
    rv = true;
return rv;
booleanbooleanValue(String s)
Returns the boolean corresponding to a given string.
return Boolean.valueOf(s).booleanValue();
booleanbooleanValue(String stringValue)
boolean Value
return stringValue != null && (stringValue.equals("1") || stringValue.equalsIgnoreCase("t")
        || stringValue.equalsIgnoreCase("true") || stringValue.equalsIgnoreCase("y")
        || stringValue.equalsIgnoreCase("yes"));
booleanbooleanValue(String tfString)
boolean Value
String trimmed = tfString.trim().toLowerCase();
return trimmed.equals("true") || trimmed.equals("t");
booleanbooleanValue(String tfString)
boolean Value
String trimmed = tfString.trim().toLowerCase();
return trimmed.equals("true") || trimmed.equals("t");
booleanbooleanValue(String tfString)
boolean Value
String trimmed = tfString.trim().toLowerCase();
return trimmed.equals("true") || trimmed.equals("t");
BooleanbooleanValueOf(boolean b)
boolean Value Of
return (b ? Boolean.TRUE : Boolean.FALSE);
booleanbooleanValueOf(Object obj)
boolean Value Of
if (obj instanceof Boolean) {
    return ((Boolean) obj).booleanValue();
} else if (obj instanceof String) {
    return Boolean.valueOf((String) obj).booleanValue();
} else {
    throw new IllegalArgumentException("Boolean or \"true\" or \"false\" expected.");
booleanbooleanValueWithYN(String string)
This method is to convert a boolean value with a y or n string.
if (string == null) {
    return false;
return string.equalsIgnoreCase("YES") || string.equalsIgnoreCase("y");
booleanconvertBoolean(Boolean convertedValue, boolean defaultValue)
convert Boolean
return (convertedValue != null) ? convertedValue : defaultValue;