Interface BooleanPredicate

All Superinterfaces:
Predicate<@NotNull Boolean>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BooleanPredicate extends Predicate<@NotNull Boolean>
Represents a predicate (boolean-valued function) of one argument. This is the primitive type specialization of Predicate for boolean.
See Also:
  • Method Details

    • testAsBoolean

      boolean testAsBoolean(boolean value)
      Evaluates this predicate on the given argument.
      Parameters:
      value - the input argument
      Returns:
      true if the input argument matches the predicate or false otherwise
    • test

      @Contract("null -> fail") default boolean test(@NotNull @NotNull Boolean value)
      Specified by:
      test in interface Predicate<@NotNull Boolean>
    • and

      @Contract(value="null -> fail; _ -> _", pure=true) @NotNull default @NotNull BooleanPredicate and(@NonNull @NonNull BooleanPredicate other)

      Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. When evaluating the composed predicate, if this predicate is false, then the other predicate is not evaluated.

      Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the other predicate will not be evaluated.

      Parameters:
      other - a predicate that will be logically-ANDed with this predicate
      Returns:
      a composed predicate that represents the short-circuiting logical AND of this predicate and the other predicate
      Throws:
      NullPointerException - if other is null
    • and

      @Contract(value="null -> fail; _ -> _", pure=true) @NotNull default @NotNull BooleanPredicate and(@NonNull @NonNull Predicate<@NotNull ? super Boolean> other)
      Specified by:
      and in interface Predicate<@NotNull Boolean>
    • or

      @Contract(value="null -> fail; _ -> _", pure=true) @NotNull default @NotNull BooleanPredicate or(@NonNull @NonNull BooleanPredicate other)

      Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. When evaluating the composed predicate, if this predicate is true, then the other predicate is not evaluated.

      Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the other predicate will not be evaluated.

      Parameters:
      other - a predicate that will be logically-ORed with this predicate
      Returns:
      a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate
      Throws:
      NullPointerException - if other is null
    • or

      @Contract(value="null -> fail; _ -> _", pure=true) @NotNull default @NotNull BooleanPredicate or(@NonNull @NonNull Predicate<@NotNull ? super Boolean> other)
      Specified by:
      or in interface Predicate<@NotNull Boolean>
    • negate

      @Contract(value="-> _", pure=true) @NotNull default @NotNull BooleanPredicate negate()
      Specified by:
      negate in interface Predicate<@NotNull Boolean>
    • isEqual

      @Contract(value="_ -> _", pure=true) @NotNull static @NotNull BooleanPredicate isEqual(boolean value)
      Returns a predicate that tests if two arguments are equal.
      Parameters:
      value - value with which to compare the tested one
      Returns:
      a predicate that tests if two arguments are equal
    • isNotEqual

      @Contract(value="_ -> _", pure=true) @NotNull static @NotNull BooleanPredicate isNotEqual(boolean value)
      Returns a predicate that tests if two arguments are not equal.
      Parameters:
      value - value with which to compare the tested one
      Returns:
      a predicate that tests if two arguments are not equal
    • alwaysTrue

      @Contract(value="-> _", pure=true) @NotNull static @NotNull DoublePredicate alwaysTrue()
      Creates a predicate which is always true.
      Returns:
      predicate which is always true
    • alwaysFalse

      @Contract(value="-> _", pure=true) @NotNull static @NotNull DoublePredicate alwaysFalse()
      Creates a predicate which is always false.
      Returns:
      predicate which is always false
    • invert

      @Contract(value="-> _", pure=true) @NotNull default @NotNull BooleanPredicate invert()
      Returns a composed operator that first applies this operator and and then inverts the result.
      Returns:
      a composed operator that first applies this operator and then inverts the result
    • identity

      @Contract(value="-> _", pure=true) @NotNull static @NotNull BooleanPredicate identity()
      Returns an unary operator that always returns its input argument.
      Returns:
      an unary operator that always returns its input argument
    • inversion

      @Contract(value="-> _", pure=true) @NotNull static @NotNull BooleanPredicate inversion()
      Returns an unary operator that always returns inverted input argument.
      Returns:
      an unary operator that always returns inverted input argument