Class ObjectSupport

java.lang.Object
net.shibboleth.shared.primitive.ObjectSupport

public final class ObjectSupport extends Object
Helper methods for working with Objects.
  • 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