Class ObjectSupport
java.lang.Object
net.shibboleth.utilities.java.support.primitive.ObjectSupport
public final class ObjectSupport extends Object
Helper methods for working with Objects.
-
Constructor Summary
Constructors Modifier Constructor Description private
ObjectSupport()
Constructor. -
Method Summary
Modifier and Type Method Description static <T> T
firstNonNull(T... objects)
Return the first from a list of arguments that is non-null, or null if all arguments are null.static int
hashCode(Object o)
Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
ObjectSupport
private ObjectSupport()Constructor.
-
-
Method Details
-
hashCode
Deprecated, for removal: This API element is subject to removal in a future version.Performs a safe (null-aware)Object.hashCode()
.- Parameters:
o
- object for which to get the hash code, may be null- Returns:
- the hash code for the object of 0 if the given object is null
-
firstNonNull
Return the first from a list of arguments that is non-null, or null if all arguments are null.This is similar to Guava's
MoreObjects.firstNonNull(Object, Object)
, except it takes more than 2 arguments, and also doesn't throw a null pointer exception if all arguments are null.- Type Parameters:
T
- the type of arguments being evaluated- Parameters:
objects
- the list of object references to evaluate- Returns:
- the first non-null argument, or null if all arguments are null
-