Interface Predicate<T>

Type Parameters:
T - the argument type
All Superinterfaces:
Predicate<T>
All Known Subinterfaces:
ByteBufferMarshaller, MarshalledValueFactory<C>, Marshaller<V,S>
All Known Implementing Classes:
AbstractByteBufferMarshaller, ByteBufferMarshalledKeyFactory, ByteBufferMarshalledValueFactory, IdentifierMarshaller, JavaByteBufferMarshaller, JBossByteBufferMarshaller, MarshalledValueMarshaller, ProtoStreamByteBufferMarshaller, WrappedMessageByteBufferMarshaller

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

    Fields
    Modifier and Type
    Field
    Description
    static final Predicate<?>
    A predicate that always returns true
    static final Predicate<?>
    A predicate that always returns false
  • 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)
     
    default <V> Predicate<V>
    compose(Function<V,T> function)
    Returns a predicate that applies the specified function to its argument before evaluating.
    default <V1,V2> BiPredicate<V1,V2>
    composeBinary(BiFunction<V1,V2,T> function)
    Returns a predicate that applies the specified function to its argument before evaluating.
    Returns a predicate that applies the specified function to its argument before evaluating.
    default IntPredicate
    Returns a predicate that applies the specified function to its argument before evaluating.
    Returns a predicate that applies the specified function to its argument before evaluating.
    static <K,V> Predicate<Map.Entry<K,V>>
    entry(Predicate<K> key, Predicate<V> value)
    Returns a predicate of a Map.Entry from the specified key and value predicates.
    static <T> Predicate<T>
    equalTo(T object)
    Returns a predicate that evaluates to true if and only if the argument is equals to the specified object.
    static <T extends Comparable<T>>
    Predicate<T>
    greaterThan(T object)
    Returns a predicate that evaluates to true if and only if the argument is comparatively greater than the specified object.
    default Predicate<T>
    Returns a new predicate that delegates to this predicate using the specified exception handler.
    static <T> Predicate<T>
    identicalTo(T object)
    Returns a predicate that evaluates to true if and only if the argument is identical to the specified object.
    static <T extends Comparable<T>>
    Predicate<T>
    lessThan(T object)
    Returns a predicate that evaluates to true if and only if the argument is comparatively less than the specified object.
    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.
    static <T> Predicate<T>
    of(Consumer<T> consumer, BooleanSupplier supplier)
    Returns a predicate that accepts its parameter via the specified consumer and returns the value returned by the specified supplier.
    default Predicate<T>
    or(Predicate<? super T> other)
     
    default Predicate<T>
    xor(Predicate<? super T> other)
    Returns a predicate returning the exclusive disjunction of this predicate with the specified predicate.

    Methods inherited from interface Predicate

    test
  • Field Details

    • ALWAYS

      static final Predicate<?> ALWAYS
      A predicate that always returns true
    • NEVER

      static final Predicate<?> NEVER
      A predicate that always returns false
  • 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> function)
      Returns a predicate that applies the specified function to its argument before evaluating.
      Type Parameters:
      V - the return type of the composed predicate
      Parameters:
      function - a mapping function
      Returns:
      a composed predicate
    • composeBinary

      default <V1,V2> BiPredicate<V1,V2> composeBinary(BiFunction<V1,V2,T> function)
      Returns a predicate that applies the specified function to its argument before evaluating.
      Type Parameters:
      V1 - the former parameter type
      V2 - the latter parameter type
      Parameters:
      function - a mapping function
      Returns:
      a composed predicate
    • composeDouble

      default DoublePredicate composeDouble(DoubleFunction<T> function)
      Returns a predicate that applies the specified function to its argument before evaluating.
      Parameters:
      function - a mapping function
      Returns:
      a composed predicate
    • composeInt

      default IntPredicate composeInt(IntFunction<T> function)
      Returns a predicate that applies the specified function to its argument before evaluating.
      Parameters:
      function - a mapping function
      Returns:
      a composed predicate
    • composeLong

      default LongPredicate composeLong(LongFunction<T> function)
      Returns a predicate that applies the specified function to its argument before evaluating.
      Parameters:
      function - a mapping function
      Returns:
      a composed predicate
    • negate

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

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

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

      default Predicate<T> xor(Predicate<? super T> other)
      Returns a predicate returning the exclusive disjunction of this predicate with the specified predicate.
      Parameters:
      other - another predicate
      Returns:
      a predicate returning the exclusive disjunction of this predicate with the specified predicate.
    • 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.
    • of

      static <T> Predicate<T> of(Consumer<T> consumer, BooleanSupplier supplier)
      Returns a predicate that accepts its parameter via the specified consumer and returns the value returned by the specified supplier.
      Type Parameters:
      T - the predicate type
      Parameters:
      consumer - the consumer of the predicate parameter
      supplier - the supplier of the predicate result
      Returns:
      a predicate that accepts its parameter via the specified consumer and returns the value returned by the specified supplier.
    • 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.
    • equalTo

      static <T> Predicate<T> equalTo(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.
    • identicalTo

      static <T> Predicate<T> identicalTo(T object)
      Returns a predicate that evaluates to true if and only if the argument is identical 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 identical to the specified object.
    • lessThan

      static <T extends Comparable<T>> Predicate<T> lessThan(T object)
      Returns a predicate that evaluates to true if and only if the argument is comparatively less than 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 comparatively less than the specified object.
    • greaterThan

      static <T extends Comparable<T>> Predicate<T> greaterThan(T object)
      Returns a predicate that evaluates to true if and only if the argument is comparatively greater than 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 comparatively greater than 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.
    • entry

      static <K,V> Predicate<Map.Entry<K,V>> entry(Predicate<K> key, Predicate<V> value)
      Returns a predicate of a Map.Entry from the specified key and value predicates.
      Type Parameters:
      K - the entry key type
      V - the entry value type
      Parameters:
      key - an entry key supplier
      value - an entry value supplier
      Returns:
      a supplier of a Map.Entry from the specified key and value suppliers.