Package com.shaiksphere.mindsmine.jems
Class BooleanHelper
java.lang.Object
com.shaiksphere.mindsmine.jems.BooleanHelper
A collection of useful static methods to deal with booleans.
- Since:
- 1.0
- Author:
- Mohammed Shaik Hussain Ali
-
Method Summary
Modifier and TypeMethodDescriptionstatic Boolean
getNullSafe
(Boolean bool) Returns a non-null boolean, even if the object being passed is a null boolean.
-
Method Details
-
getNullSafe
Returns a non-null boolean, even if the object being passed is a null boolean.
If the passed-in object is a non-null boolean, then it is returned as-is.
Example usage:Boolean bool1 = true; Boolean bool2 = null; Boolean bool3 = BooleanHelper.getNullSafe(bool1); Boolean bool4 = BooleanHelper.getNullSafe(bool2); // bool3 now contains the boolean: true // bool4 now contains the boolean: false
- Parameters:
bool
- The boolean to safeguard againstnull
.- Returns:
- If bool is
null
thenBoolean.FALSE
. - Since:
- 1.0
-