In Java, you would usually say that
if(someBool != false)
is the same as
if(someBool)
But what if someBool
is not of type boolean
but Boolean
, and its value is null
?
If you want to handle Boolean
instances as well as primitives and be null-safe, you can use this:
if(Boolean.TRUE.equals(someBool))