Package dev.prozilla.pine.common.util
Class ObjectUtils
java.lang.Object
dev.prozilla.pine.common.util.ObjectUtils
Utility methods related to objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <I,O> O preserveNull(I input, Function<I, O> function) Applies a function to an object and returns the result, or immediately returnsnullwithout calling the function if the input object isnull.static booleanSafely unboxes a boxed value and turnsnullinto the default value.static charSafely unboxes a boxed value and turnsnullinto the default value.static floatSafely unboxes a boxed value and turnsnullinto the default value.static intSafely unboxes a boxed value and turnsnullinto the default value.
-
Method Details
-
preserveNull
Applies a function to an object and returns the result, or immediately returnsnullwithout calling the function if the input object isnull.- Type Parameters:
I- The type of the input objectO- The type of the result object- Parameters:
input- The input objectfunction- The function to apply to the object- Returns:
- The result of the function, or
null.
-
unbox
Safely unboxes a boxed value and turnsnullinto the default value.- Parameters:
value- The boxed value- Returns:
- The unboxed value.
-
unbox
Safely unboxes a boxed value and turnsnullinto the default value.- Parameters:
value- The boxed value- Returns:
- The unboxed value.
-
unbox
Safely unboxes a boxed value and turnsnullinto the default value.- Parameters:
value- The boxed value- Returns:
- The unboxed value.
-
unbox
Safely unboxes a boxed value and turnsnullinto the default value.- Parameters:
value- The boxed value- Returns:
- The unboxed value.
-