Interface Predicate<T>

Type Parameters:
T - the argument type
All Superinterfaces:
Predicate<T>
All Known Implementing Classes:
Predicate.SimplePredicate

public interface Predicate<T> extends Predicate<T>
An enhanced predicate.
Author:
Paul Ferraro
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Predicate<?>
     
    static final Predicate<?>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Predicate<T>
    Returns a predicate that always accepts its argument.
    default Predicate<T>
    and(Predicate<? super T> other)
     
    Returns a predicate that applies the specified mapping to its argument before evaluating.
    default <V> Predicate<V>
    compose(Function<V,T> mapper)
    Returns a predicate that applies the specified mapping to its argument before evaluating.
    default IntPredicate
    Returns a predicate that applies the specified mapping to its argument before evaluating.
    Returns a predicate that applies the specified mapping to its argument before evaluating.
    static <T> Predicate<T>
    equal(T object)
    Returns a predicate that evaluates to true if and only if the argument is equals to the specified object.
    default Predicate<T>
    Returns a new predicate that delegates to this predicate using the specified exception handler.
    default Predicate<T>
     
    static <T> Predicate<T>
    Returns a predicate that never accepts its argument.
    static <T> Predicate<T>
    not(Predicate<? super T> predicate)
    Returns a predicate that evaluates to the negation of the specified predicate.
    static <T> Predicate<T>
    of(boolean result)
    Returns a predicate that always evaluates to the specified result.
    default Predicate<T>
    or(Predicate<? super T> other)
     
    static <T> Predicate<T>
    same(T object)
    Returns a predicate that evaluates to true if and only if the argument references the specified object.

    Methods inherited from interface java.util.function.Predicate

    test
  • Field Details

  • Method Details

    • handle

      default Predicate<T> handle(BiPredicate<T,RuntimeException> handler)
      Returns a new predicate that delegates to this predicate using the specified exception handler.
      Parameters:
      handler - an exception handler
      Returns:
      a new predicate that delegates to this predicate using the specified exception handler.
    • compose

      default <V> Predicate<V> compose(Function<V,T> mapper)
      Returns a predicate that applies the specified mapping to its argument before evaluating.
      Type Parameters:
      V - the mapped type
      Parameters:
      mapper -
      Returns:
      a mapped predicate
    • compose

      default DoublePredicate compose(DoubleFunction<T> mapper)
      Returns a predicate that applies the specified mapping to its argument before evaluating.
      Parameters:
      mapper -
      Returns:
      a mapped predicate
    • compose

      default IntPredicate compose(IntFunction<T> mapper)
      Returns a predicate that applies the specified mapping to its argument before evaluating.
      Parameters:
      mapper -
      Returns:
      a mapped predicate
    • compose

      default LongPredicate compose(LongFunction<T> mapper)
      Returns a predicate that applies the specified mapping to its argument before evaluating.
      Parameters:
      mapper -
      Returns:
      a mapped predicate
    • and

      default Predicate<T> and(Predicate<? super T> other)
      Specified by:
      and in interface Predicate<T>
    • negate

      default Predicate<T> negate()
      Specified by:
      negate in interface Predicate<T>
    • or

      default Predicate<T> or(Predicate<? super T> other)
      Specified by:
      or in interface Predicate<T>
    • of

      static <T> Predicate<T> of(boolean result)
      Returns a predicate that always evaluates to the specified result.
      Type Parameters:
      T - the argument type
      Parameters:
      result - the fixed result
      Returns:
      a predicate that always evaluates to the specified value.
    • always

      static <T> Predicate<T> always()
      Returns a predicate that always accepts its argument.
      Type Parameters:
      T - the argument type
      Returns:
      a predicate that always accepts its argument.
    • never

      static <T> Predicate<T> never()
      Returns a predicate that never accepts its argument.
      Type Parameters:
      T - the argument type
      Returns:
      a predicate that never accepts its argument.
    • equal

      static <T> Predicate<T> equal(T object)
      Returns a predicate that evaluates to true if and only if the argument is equals to the specified object.
      Type Parameters:
      T - the argument type
      Parameters:
      object - the object whose reference must match the predicate argument
      Returns:
      a predicate that evaluates to true if and only if the argument is equals to the specified object.
    • same

      static <T> Predicate<T> same(T object)
      Returns a predicate that evaluates to true if and only if the argument references the specified object.
      Type Parameters:
      T - the argument type
      Parameters:
      object - the object whose reference must match the predicate argument
      Returns:
      a predicate that evaluates to true if and only if the argument references the specified object.
    • not

      static <T> Predicate<T> not(Predicate<? super T> predicate)
      Returns a predicate that evaluates to the negation of the specified predicate.
      Type Parameters:
      T - the argument type
      Parameters:
      predicate - the predicate to negate
      Returns:
      a predicate that evaluates to the negation of the specified predicate.