Class Predicates

java.lang.Object
com.helger.base.functional.Predicates

@Immutable public final class Predicates extends Object
Some globally usable predicates.
Since:
9.1.3
Author:
Philip Helger
  • Method Details

    • all

      public static <DATATYPE> @NonNull Predicate<DATATYPE> all()
      Type Parameters:
      DATATYPE - The data type to be checked.
      Returns:
      A predicate that always returns true. Never null.
    • none

      public static <DATATYPE> @NonNull Predicate<DATATYPE> none()
      Type Parameters:
      DATATYPE - The data type to be checked.
      Returns:
      A predicate that always returns false. Never null.
    • notNull

      public static <DATATYPE> @NonNull Predicate<DATATYPE> notNull()
      Type Parameters:
      DATATYPE - The data type to be checked.
      Returns:
      A predicate that returns true if the value is not null. Never null.
    • isNull

      public static <DATATYPE> @NonNull Predicate<DATATYPE> isNull()
      Type Parameters:
      DATATYPE - The data type to be checked.
      Returns:
      A predicate that returns true if the value is null. Never null.
    • charIsEQ0

      public static @NonNull ICharPredicate charIsEQ0()
      Returns:
      A char predicate that checks for equality with 0. Never null.
    • charIsNE0

      public static @NonNull ICharPredicate charIsNE0()
      Returns:
      A char predicate that checks for inequality with 0. Never null.
    • charIsGT0

      public static @NonNull ICharPredicate charIsGT0()
      Returns:
      A char predicate that checks for values > 0. Never null.
    • doubleIsLT0

      public static @NonNull DoublePredicate doubleIsLT0()
      Returns:
      A double predicate that checks for values < 0. Never null.
    • doubleIsLE0

      public static @NonNull DoublePredicate doubleIsLE0()
      Returns:
      A double predicate that checks for values ≤ 0. Never null.
    • doubleIsEQ0

      public static @NonNull DoublePredicate doubleIsEQ0()
      Returns:
      A double predicate that checks for equality with 0. Never null.
    • doubleIsNE0

      public static @NonNull DoublePredicate doubleIsNE0()
      Returns:
      A double predicate that checks for inequality with 0. Never null.
    • doubleIsGE0

      public static @NonNull DoublePredicate doubleIsGE0()
      Returns:
      A double predicate that checks for values ≥ 0. Never null.
    • doubleIsGT0

      public static @NonNull DoublePredicate doubleIsGT0()
      Returns:
      A double predicate that checks for values > 0. Never null.
    • intIsLT0

      public static @NonNull IntPredicate intIsLT0()
      Returns:
      An int predicate that checks for values < 0. Never null.
    • intIsLE0

      public static @NonNull IntPredicate intIsLE0()
      Returns:
      An int predicate that checks for values ≤ 0. Never null.
    • intIsEQ0

      public static @NonNull IntPredicate intIsEQ0()
      Returns:
      An int predicate that checks for equality with 0. Never null.
    • intIsNE0

      public static @NonNull IntPredicate intIsNE0()
      Returns:
      An int predicate that checks for inequality with 0. Never null.
    • intIsGE0

      public static @NonNull IntPredicate intIsGE0()
      Returns:
      An int predicate that checks for values ≥ 0. Never null.
    • intIsGT0

      public static @NonNull IntPredicate intIsGT0()
      Returns:
      An int predicate that checks for values > 0. Never null.
    • longIsLT0

      public static @NonNull LongPredicate longIsLT0()
      Returns:
      A long predicate that checks for values < 0. Never null.
    • longIsLE0

      public static @NonNull LongPredicate longIsLE0()
      Returns:
      A long predicate that checks for values ≤ 0. Never null.
    • longIsEQ0

      public static @NonNull LongPredicate longIsEQ0()
      Returns:
      A long predicate that checks for equality with 0. Never null.
    • longIsNE0

      public static @NonNull LongPredicate longIsNE0()
      Returns:
      A long predicate that checks for inequality with 0. Never null.
    • longIsGE0

      public static @NonNull LongPredicate longIsGE0()
      Returns:
      A long predicate that checks for values ≥ 0. Never null.
    • longIsGT0

      public static @NonNull LongPredicate longIsGT0()
      Returns:
      A long predicate that checks for values > 0. Never null.
    • and

      public static <T> @Nullable Predicate<T> and(@Nullable Predicate<? super T> aFirst, @Nullable Predicate<? super T> aSecond)
      Combine two predicates with a logical AND. If both are null, null is returned.
      Type Parameters:
      T - The data type to be checked.
      Parameters:
      aFirst - The first predicate. May be null.
      aSecond - The second predicate. May be null.
      Returns:
      The combined predicate, or null if both are null.
    • or

      public static <T> @Nullable Predicate<T> or(@Nullable Predicate<? super T> aFirst, @Nullable Predicate<? super T> aSecond)
      Combine two predicates with a logical OR. If both are null, null is returned.
      Type Parameters:
      T - The data type to be checked.
      Parameters:
      aFirst - The first predicate. May be null.
      aSecond - The second predicate. May be null.
      Returns:
      The combined predicate, or null if both are null.