Interface BiPredicate<T,U>

Type Parameters:
T - the former parameter type
U - the latter parameter type
All Superinterfaces:
BiPredicate<T,U>

public interface BiPredicate<T,U> extends BiPredicate<T,U>
An enhanced binary predicate.
Author:
Paul Ferraro
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BiPredicate<?,?>
    A predicate that always returns true
    static final BiPredicate<?,?>
    A predicate that always returns false
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T,U> BiPredicate<T,U>
    Returns a predicate that always accepts its arguments.
    default BiPredicate<T,U>
    and(BiPredicate<? super T, ? super U> other)
     
    static <T,U> BiPredicate<T,U>
    and(Predicate<T> predicate1, Predicate<U> predicate2)
    Returns a binary predicate composed using the conjunction of two unary predicates.
    default <V1,V2> BiPredicate<V1,V2>
    compose(Function<? super V1, ? extends T> before1, Function<? super V2, ? extends U> before2)
    Composes a predicate that applies the specified functions to each parameter as inputs to this predicate.
    default <V> Predicate<V>
    composeUnary(Function<? super V, ? extends T> before1, Function<? super V, ? extends U> before2)
    Composes a unary predicate that applies the specified functions to its parameter as inputs to this predicate.
    default BiPredicate<T,U>
     
    static <T,U> BiPredicate<T,U>
    Returns a predicate that never accepts its arguments.
    static <T,U> BiPredicate<T,U>
    of(boolean value)
    Returns a predicate that always returns the specified value.
    static <T,U> BiPredicate<T,U>
    of(BiConsumer<T,U> consumer, BooleanSupplier supplier)
    Returns a predicate that accepts its parameter via the specified consumer and returns the value returned by the specified supplier.
    default BiPredicate<T,U>
    or(BiPredicate<? super T, ? super U> other)
     
    static <T,U> BiPredicate<T,U>
    or(Predicate<T> predicate1, Predicate<U> predicate2)
    Returns a binary predicate composed using the disjunction of two unary predicates.
    default BiPredicate<U,T>
    Returns a predicate that processes this predicate with reversed parameter order.
    static <T,U> BiPredicate<T,U>
    testFormer(Predicate<T> predicate)
    Returns a binary predicate from a predicate that tests the first parameter only.
    static <T,U> BiPredicate<T,U>
    testLatter(Predicate<U> predicate)
    Returns a binary predicate from a predicate that tests the second parameter only.
    default BiPredicate<T,U>
    xor(BiPredicate<? super T, ? super U> other)
    Returns a composed predicate that represents a logical XOR of the specified predicate.
    static <T,U> BiPredicate<T,U>
    xor(Predicate<T> predicate1, Predicate<U> predicate2)
    Returns a binary predicate composed using the exclusive disjunction of two unary predicates.

    Methods inherited from interface BiPredicate

    test
  • Field Details

    • ALWAYS

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

      static final BiPredicate<?,?> NEVER
      A predicate that always returns false
  • Method Details

    • and

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

      default BiPredicate<T,U> negate()
      Specified by:
      negate in interface BiPredicate<T,U>
    • or

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

      default BiPredicate<T,U> xor(BiPredicate<? super T, ? super U> other)
      Returns a composed predicate that represents a logical XOR of the specified predicate.
      Parameters:
      other - another predicate that should evaluate to the opposite of this one.
      Returns:
      a composed predicate that represents a logical XOR of the specified predicate.
    • reverse

      default BiPredicate<U,T> reverse()
      Returns a predicate that processes this predicate with reversed parameter order.
      Returns:
      a predicate that processes this predicate with reversed parameter order.
    • compose

      default <V1,V2> BiPredicate<V1,V2> compose(Function<? super V1, ? extends T> before1, Function<? super V2, ? extends U> before2)
      Composes a predicate that applies the specified functions to each parameter as inputs to this predicate.
      Type Parameters:
      V1 - the first parameter function type
      V2 - the second parameter function type
      Parameters:
      before1 - the function applied to the first parameter
      before2 - the function applied to the second parameter
      Returns:
      a predicate that applies the specified functions to each parameter as inputs to this predicate.
    • composeUnary

      default <V> Predicate<V> composeUnary(Function<? super V, ? extends T> before1, Function<? super V, ? extends U> before2)
      Composes a unary predicate that applies the specified functions to its parameter as inputs to this predicate.
      Type Parameters:
      V - the parameter function type
      Parameters:
      before1 - the function applied to the first parameter
      before2 - the function applied to the second parameter
      Returns:
      a unary predicate that applies the specified functions to its parameter as inputs to this predicate.
    • always

      static <T,U> BiPredicate<T,U> always()
      Returns a predicate that always accepts its arguments.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Returns:
      a predicate that always accepts its arguments.
    • never

      static <T,U> BiPredicate<T,U> never()
      Returns a predicate that never accepts its arguments.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Returns:
      a predicate that never accepts its arguments.
    • of

      static <T,U> BiPredicate<T,U> of(boolean value)
      Returns a predicate that always returns the specified value.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Parameters:
      value - the value to be returned by this predicate
      Returns:
      a predicate that always returns the specified value.
    • of

      static <T,U> BiPredicate<T,U> of(BiConsumer<T,U> 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 former parameter type
      U - the latter parameter 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.
    • testFormer

      static <T,U> BiPredicate<T,U> testFormer(Predicate<T> predicate)
      Returns a binary predicate from a predicate that tests the first parameter only.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Parameters:
      predicate - the predicate for the first parameter
      Returns:
      a binary predicate from a predicate that tests the first parameter only.
    • testLatter

      static <T,U> BiPredicate<T,U> testLatter(Predicate<U> predicate)
      Returns a binary predicate from a predicate that tests the second parameter only.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Parameters:
      predicate - the predicate for the first parameter
      Returns:
      a binary predicate from a predicate that tests the first parameter only.
    • and

      static <T,U> BiPredicate<T,U> and(Predicate<T> predicate1, Predicate<U> predicate2)
      Returns a binary predicate composed using the conjunction of two unary predicates.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Parameters:
      predicate1 - the predicate for the first parameter
      predicate2 - the predicate for the second parameter
      Returns:
      a binary predicate composed using the conjunction of two unary predicates.
    • or

      static <T,U> BiPredicate<T,U> or(Predicate<T> predicate1, Predicate<U> predicate2)
      Returns a binary predicate composed using the disjunction of two unary predicates.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Parameters:
      predicate1 - the predicate for the first parameter
      predicate2 - the predicate for the second parameter
      Returns:
      a binary predicate composed using the disjunction of two unary predicates.
    • xor

      static <T,U> BiPredicate<T,U> xor(Predicate<T> predicate1, Predicate<U> predicate2)
      Returns a binary predicate composed using the exclusive disjunction of two unary predicates.
      Type Parameters:
      T - the former parameter type
      U - the latter parameter type
      Parameters:
      predicate1 - the predicate for the first parameter
      predicate2 - the predicate for the second parameter
      Returns:
      a binary predicate composed using the exclusive disjunction of two unary predicates.