Boolean to String


code-fun java

Long time ago I’ve found this little gem:

if( value.equalsIgnoreCase(String.valueOf(Boolean.TRUE)) )
    return Boolean.TRUE.booleanValue();
else if( value.equalsIgnoreCase(String.valueOf(Boolean.FALSE)) )
    return Boolean.FALSE.booleanValue();

Interestingly the rest of the code made it impossible to:

Therefore the code is effectively this:

return Boolean.parseBoolean(value);