Package net.shibboleth.shared.primitive

# Class ObjectSupport

java.lang.Object
net.shibboleth.shared.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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ObjectSupport

private ObjectSupport()
Constructor.

## Method Details

### firstNonNull

@SafeVarargs @Nullable public static <T> T firstNonNull(@Nullable @NullableElements T... objects)
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