Interface Predicate<T>

Type Parameters:
T - The type of the input to the predicate.
All Superinterfaces:
Predicate<T>
All Known Subinterfaces:
PredicateDecorator<T>
All Known Implementing Classes:
AbstractPredicate, AbstractQuantifierPredicate, AllPredicate, AndPredicate, AnyPredicate, ComparatorPredicate, EqualPredicate, ExceptionPredicate, FalsePredicate, IdentityPredicate, InstanceofPredicate, NonePredicate, NotNullPredicate, NotPredicate, NullIsExceptionPredicate, NullIsFalsePredicate, NullIsTruePredicate, NullPredicate, OnePredicate, OrPredicate, TransformedPredicate, TransformerPredicate, TruePredicate, UniquePredicate

public interface Predicate<T> extends Predicate<T>
Defines a functor interface implemented by classes that perform a predicate test on an object.

A Predicate is the object equivalent of an if statement. It uses the input object to return a true or false value, and is often used in validation or filtering.

Standard implementations of common predicates are provided by PredicateUtils. These include true, false, instanceof, equals, and, or, not, method invocation and null testing.

Since:
1.0 This will be deprecated in 5.0 in favor of Predicate.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    evaluate(T object)
    Use the specified parameter to perform a test that returns true or false.
    default boolean
    test(T t)
     

    Methods inherited from interface java.util.function.Predicate

    and, negate, or
  • Method Details

    • evaluate

      boolean evaluate(T object)
      Use the specified parameter to perform a test that returns true or false.
      Parameters:
      object - The object to evaluate, should not be changed.
      Returns:
      true or false.
      Throws:
      ClassCastException - (runtime) if the input is the wrong class.
      IllegalArgumentException - (runtime) if the input is invalid.
      FunctorException - (runtime) if the predicate encounters a problem.
    • test

      default boolean test(T t)
      Specified by:
      test in interface Predicate<T>