java.lang.Object
is.codion.common.utilities.Nulls

public final class Nulls extends Object
Utility class for working with nulls.
  • Method Details

    • nonNull

      public static boolean nonNull(@Nullable Object... objects)
      Returns true if none of the given objects are null, false if the array itself is null, and true if no objects are provided.

      Use Objects.nonNull(Object) for single values, to eliminate varargs array creation.

      Parameters:
      objects - the objects to check
      Returns:
      true if none of the given objects are null, false if the array itself is null, true if no objects are provided
    • rejectNulls

      public static <C extends Collection<T>, T> C rejectNulls(@Nullable C items)
      Throws a NullPointerException if the given collection, or any of its items, is null
      Type Parameters:
      C - the collection type
      T - the collection element type
      Parameters:
      items - the items to check for nulls
      Returns:
      the items