Interface BiPredicate<T,U>
- Type Parameters:
T- the former parameter typeU- the latter parameter type
- All Superinterfaces:
BiPredicate<T,U>
An enhanced binary predicate.
- Author:
- Paul Ferraro
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BiPredicate<?, ?> A predicate that always returns truestatic final BiPredicate<?, ?> A predicate that always returns false -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,U> BiPredicate <T, U> always()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> Returns a binary predicate composed using the conjunction of two unary predicates.default <V1,V2> BiPredicate <V1, V2> 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> negate()static <T,U> BiPredicate <T, U> never()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> Returns a binary predicate composed using the disjunction of two unary predicates.default BiPredicate<U, T> reverse()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> Returns a binary predicate composed using the exclusive disjunction of two unary predicates.Methods inherited from interface BiPredicate
test
-
Field Details
-
ALWAYS
A predicate that always returns true -
NEVER
A predicate that always returns false
-
-
Method Details
-
and
- Specified by:
andin interfaceBiPredicate<T,U>
-
negate
- Specified by:
negatein interfaceBiPredicate<T,U>
-
or
- Specified by:
orin interfaceBiPredicate<T,U>
-
xor
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
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 typeV2- the second parameter function type- Parameters:
before1- the function applied to the first parameterbefore2- 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 parameterbefore2- 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
Returns a predicate that always accepts its arguments.- Type Parameters:
T- the former parameter typeU- the latter parameter type- Returns:
- a predicate that always accepts its arguments.
-
never
Returns a predicate that never accepts its arguments.- Type Parameters:
T- the former parameter typeU- the latter parameter type- Returns:
- a predicate that never accepts its arguments.
-
of
Returns a predicate that always returns the specified value.- Type Parameters:
T- the former parameter typeU- the latter parameter type- Parameters:
value- the value to be returned by this predicate- Returns:
- a predicate that always returns the specified value.
-
of
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 typeU- the latter parameter type- Parameters:
consumer- the consumer of the predicate parametersupplier- 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
Returns a binary predicate from a predicate that tests the first parameter only.- Type Parameters:
T- the former parameter typeU- 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
Returns a binary predicate from a predicate that tests the second parameter only.- Type Parameters:
T- the former parameter typeU- 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
Returns a binary predicate composed using the conjunction of two unary predicates.- Type Parameters:
T- the former parameter typeU- the latter parameter type- Parameters:
predicate1- the predicate for the first parameterpredicate2- the predicate for the second parameter- Returns:
- a binary predicate composed using the conjunction of two unary predicates.
-
or
Returns a binary predicate composed using the disjunction of two unary predicates.- Type Parameters:
T- the former parameter typeU- the latter parameter type- Parameters:
predicate1- the predicate for the first parameterpredicate2- the predicate for the second parameter- Returns:
- a binary predicate composed using the disjunction of two unary predicates.
-
xor
Returns a binary predicate composed using the exclusive disjunction of two unary predicates.- Type Parameters:
T- the former parameter typeU- the latter parameter type- Parameters:
predicate1- the predicate for the first parameterpredicate2- the predicate for the second parameter- Returns:
- a binary predicate composed using the exclusive disjunction of two unary predicates.
-