Package eu.bandm.tools.util.java
Class BiPredicates
java.lang.Object
eu.bandm.tools.util.java.BiPredicates
Library of constants and combinators for classes implementing
BiPredicate
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <A,
B> BiPredicate <A, B> all()
Returns a binary predicate that is true for all arguments.static <A,
B> BiPredicate <A, B> complement
(BiPredicate<? super A, ? super B> pred) Returns a binary predicate that is true for all arguments where the given predicate is false and vice versa.static <A,
B> BiPredicate <Collection<? extends A>, Collection<? extends B>> cover
(BiPredicate<A, B> rel) static <A,
B> BiPredicate <A, B> eq()
Returns a binary predicate that is true if and only if the arguments are identical.static <A extends Comparable<? super A>>
BiPredicate<A, A> equal()
Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the natural order.static <A> BiPredicate
<A, A> equal
(Comparator<? super A> order) Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the given order.static <A,
B> BiPredicate <A, B> equals()
Deprecated.static <A,
B> BiPredicate <A, B> Deprecated, for removal: This API element is subject to removal in a future version.useObject::equals
insteadstatic <A extends Comparable<? super A>>
BiPredicate<A, A> greater()
Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the natural order.static <A> BiPredicate
<A, A> greater
(Comparator<? super A> order) Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the given order.static <A extends Comparable<? super A>>
BiPredicate<A, A> Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the natural order.static <A> BiPredicate
<A, A> greaterOrEqual
(Comparator<? super A> order) Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the given order.static <A,
B> BiPredicate <A, B> intersection
(Collection<? extends BiPredicate<? super A, ? super B>> rels) Returns a predicate that is true for all arguments where all of the given predicates are.static <A,
B> BiPredicate <B, A> inverse
(BiPredicate<? super A, ? super B> pred) Returns a binary predicate that is true for all arguments where the given predicate is for the flipped pair of arguments.static <A,
B> BiPredicate <A, A> kernel
(Function<? super A, ? extends B> fun, BiPredicate<? super B, ? super B> pred) static <A,
B, C, D>
BiPredicate<A, C> kernel
(Function<? super A, ? extends B> left, Function<? super C, ? extends D> right, BiPredicate<? super B, ? super D> pred) static <A extends Comparable<? super A>>
BiPredicate<A, A> less()
Returns a binary predicate that is true if and only if the first argument is less than the second, according to the natural order.static <A> BiPredicate
<A, A> less
(Comparator<? super A> order) Returns a binary predicate that is true if and only if the first argument is less than the second, according to the given order.static <A extends Comparable<? super A>>
BiPredicate<A, A> Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the natural order.static <A> BiPredicate
<A, A> lessOrEqual
(Comparator<? super A> order) Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the given order.static <A,
B> BiPredicate <A, B> none()
Returns a binary predicate that is false for all arguments.static <A,
B> BiPredicate <A, B> union
(Collection<? extends BiPredicate<? super A, ? super B>> rels)
-
Method Details
-
all
Returns a binary predicate that is true for all arguments.- Type Parameters:
A
- the first argument typeB
- the second argument type- Returns:
- a binary predicate that is true for all arguments, including null
-
none
Returns a binary predicate that is false for all arguments.- Type Parameters:
A
- the first argument typeB
- the second argument type- Returns:
- a binary predicate that is false for all arguments, including null
-
eq
Returns a binary predicate that is true if and only if the arguments are identical.- Type Parameters:
A
- the first argument typeB
- the second argument type- Returns:
- a binary predicate that true if and only if the arguments
are identical according to
==
-
equals
Deprecated.useObject::equals
insteadReturns a binary predicate that is true if and only if the arguments are equal.- Type Parameters:
A
- the first argument typeB
- the second argument type- Returns:
- a binary predicate that true if and only if the arguments
are equal according to
Objects.equals(Object, Object)
-
equalsOrNull
Deprecated, for removal: This API element is subject to removal in a future version.useObject::equals
insteadReturns a binary predicate that is true if and only if the arguments are equal.- Type Parameters:
A
- the first argument typeB
- the second argument type- Returns:
- a binary predicate that true if and only if the arguments
are equal according to
Objects.equals(Object, Object)
-
lessOrEqual
Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the given order.- Type Parameters:
A
- the argument type- Parameters:
order
- a comparator that specifies the desired order- Returns:
- a binary predicate that true if and only if the first
argument is less than or equal to the second according to
Comparator.compare(T, T)
- Throws:
NullPointerException
- iforder
is null
-
lessOrEqual
Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the natural order.- Type Parameters:
A
- the argument type- Returns:
- a binary predicate that true if and only if the first
argument is less than or equal to the second according to
Comparable.compareTo(T)
-
less
Returns a binary predicate that is true if and only if the first argument is less than the second, according to the given order.- Type Parameters:
A
- the argument type- Parameters:
order
- a comparator that specifies the desired order- Returns:
- a binary predicate that true if and only if the first
argument is less than the second according to
Comparator.compare(T, T)
- Throws:
NullPointerException
- iforder
is null
-
less
Returns a binary predicate that is true if and only if the first argument is less than the second, according to the natural order.- Type Parameters:
A
- the argument type- Returns:
- a binary predicate that true if and only if the first
argument is less than the second according to
Comparable.compareTo(T)
-
equal
Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the natural order.- Type Parameters:
A
- the argument type- Returns:
- a binary predicate that true if and only if the first
argument is equal to the second according to
Comparable.compareTo(T)
-
greater
Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the natural order.- Type Parameters:
A
- the argument type- Returns:
- a binary predicate that true if and only if the first
argument is greater than the second according to
Comparable.compareTo(T)
-
greaterOrEqual
Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the natural order.- Type Parameters:
A
- the argument type- Returns:
- a binary predicate that true if and only if the first
argument is greater than or equal to the second according to
Comparable.compareTo(T)
-
greaterOrEqual
Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the given order.- Type Parameters:
A
- the argument type- Parameters:
order
- a comparator that specifies the desired order- Returns:
- a binary predicate that true if and only if the first
argument is greater than or equal to the second according to
Comparator.compare(T, T)
- Throws:
NullPointerException
- iforder
is null
-
greater
Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the given order.- Type Parameters:
A
- the argument type- Parameters:
order
- a comparator that specifies the desired order- Returns:
- a binary predicate that true if and only if the first
argument is greater than the second according to
Comparator.compare(T, T)
- Throws:
NullPointerException
- iforder
is null
-
equal
Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the given order.- Type Parameters:
A
- the argument type- Parameters:
order
- a comparator that specifies the desired order- Returns:
- a binary predicate that true if and only if the first
argument is equal to the second according to
Comparator.compare(T, T)
- Throws:
NullPointerException
- iforder
is null
-
inverse
Returns a binary predicate that is true for all arguments where the given predicate is for the flipped pair of arguments.- Type Parameters:
A
- the first argument typeB
- the second argument type- Parameters:
pred
- a binary predicate- Returns:
- a binary predicate that is true for
(a, b)
if and only ifpred
is true for(b, a)
- Throws:
NullPointerException
- ifpred
is null
-
complement
Returns a binary predicate that is true for all arguments where the given predicate is false and vice versa.- Type Parameters:
A
- the first argument typeB
- the second argument type- Parameters:
pred
- a binary predicate- Returns:
- a binary predicate that is true for all arguments where
pred
is false and vice versa - Throws:
NullPointerException
- ifpred
is null
-
kernel
public static <A,B, BiPredicate<A,C, D> C> kernel(Function<? super A, ? extends B> left, Function<? super C, ? extends D> right, BiPredicate<? super B, ? super D> pred) -
kernel
public static <A,B> BiPredicate<A,A> kernel(Function<? super A, ? extends B> fun, BiPredicate<? super B, ? super B> pred) -
cover
public static <A,B> BiPredicate<Collection<? extends A>,Collection<? extends B>> cover(BiPredicate<A, B> rel) -
union
public static <A,B> BiPredicate<A,B> union(Collection<? extends BiPredicate<? super A, ? super B>> rels) -
intersection
public static <A,B> BiPredicate<A,B> intersection(Collection<? extends BiPredicate<? super A, ? super B>> rels) Returns a predicate that is true for all arguments where all of the given predicates are.- Type Parameters:
A
- the first argument typeB
- the second argument type- Parameters:
rels
- a collection of binary predicates- Returns:
- a predicate that FIXME
- Throws:
NullPointerException
- ifrels
or any element of it is null
-
Object::equals
instead