Java Utililty Methods Boolean Parse

List of utility methods to do Boolean Parse

Description

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

Method

BooleantryParseBool(Object obj, Boolean defaultVal)
try Parse Bool
if (obj == null)
    return defaultVal;
if (obj instanceof Boolean)
    return (Boolean) obj;
try {
    String val = obj.toString();
    return Boolean.parseBoolean(val);
} catch (Exception e) {
...
booleantryParseBool(String value)
try Parse Bool
try {
    Boolean.parseBoolean(value);
    return true;
} catch (Exception e) {
    return false;
booleantryParseBoolean(String value)
Returns whether or not the String can be parsed as an Boolean
return value.equals("true") || value.equals("false");
BooleantryParseBoolean(String value)
try Parse Boolean
if (value == null) {
    return null;
if (value.equalsIgnoreCase("true")) {
    return true;
} else if (value.equalsIgnoreCase("false")) {
    return false;
return null;