Package de.espirit.common.tools
Class Objects
java.lang.Object
de.espirit.common.tools.Objects
Generic utility to provide null-safe operations.
- Since:
- 5.2.21
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Objects
public Objects()
-
-
Method Details
-
equal
Test the given objects on equality. Will returntrue
, if either a and b are null or a.equals(b). For arrays the content is compared for equality (deep equals).- Parameters:
a
- first object to compare.b
- second object to compare.- Returns:
true
, if a is equal to b or both a and b are null.- Since:
- 5.2.21
-
nvl
@NotNull public static <T,D extends T> T nvl(@Nullable T value, @NotNull D defaultValue) Returns the first parameter if it's notnull
, else the second.- Parameters:
value
- Value to return if notnull
.defaultValue
- Value tor return if first argument isnull
- must be notnull
.- Returns:
- Returns the first parameter if it's not
null
, else the second. - Since:
- 5.2.21
-