P1
- parameter type 1P2
- parameter type 2P3
- parameter type 3P4
- parameter type 4@FunctionalInterface
public interface Predicate4<P1,P2,P3,P4>
and(Predicate4)
, or(Predicate4)
,
xor(Predicate4)
, and negate()
.
There is a general problem with combining types which don't
allow to use the above combination methods in all cases
similar to standard Java's logical expressions. The following
static methods of this interface may be used in all cases:
and(Predicate4, Predicate4)
,
or(Predicate4, Predicate4)
,
and xor(Predicate4, Predicate4)
.
Useful for start values in algorithms or as default values
are the two values returned by alwaysTrue()
(a predicate which always returns true
regardless
the argument applied to the test(Object, Object, Object, Object)
method)
and alwaysFalse()
(same for false
).
Partial evaluation is also possible.
Predicate1
,
Predicate2
,
Predicate3
,
Predicate5
,
Predicate6
,
Predicate7
,
Predicate8
,
Predicate9
Modifier and Type | Method and Description |
---|---|
static <T1,T2,T3,T4> |
alwaysFalse()
Get a predicate which always evaluates to
false . |
static <T1,T2,T3,T4> |
alwaysTrue()
Get a predicate which always evaluates to
true . |
default Predicate4<P1,P2,P3,P4> |
and(Predicate4<? super P1,? super P2,? super P3,? super P4> other)
Combine this and another predicate with logical and.
|
static <T1,T2,T3,T4> |
and(Predicate4<? super T1,? super T2,? super T3,? super T4> pred1,
Predicate4<? super T1,? super T2,? super T3,? super T4> pred2)
Get a predicate which is the combination of two predicates
with a logical and.
|
default Predicate4<P1,P2,P3,P4> |
negate()
Get the negation of this predicate.
|
default Predicate4<P1,P2,P3,P4> |
or(Predicate4<? super P1,? super P2,? super P3,? super P4> other)
Combine this and another predicate with logical or.
|
static <T1,T2,T3,T4> |
or(Predicate4<? super T1,? super T2,? super T3,? super T4> pred1,
Predicate4<? super T1,? super T2,? super T3,? super T4> pred2)
Get a predicate which is the combination of two predicates
with a logical or.
|
default Predicate3<P2,P3,P4> |
partial1(P1 argument)
Get a partially applied predicate with a fix first argument.
|
default Predicate3<P1,P3,P4> |
partial2(P2 argument)
Get a partially applied predicate with a fix second argument.
|
default Predicate3<P1,P2,P4> |
partial3(P3 argument)
Get a partially applied predicate with a fix third argument.
|
default Predicate3<P1,P2,P3> |
partial4(P4 argument)
Get a partially applied predicate with a fix fourth argument.
|
boolean |
test(P1 arg1,
P2 arg2,
P3 arg3,
P4 arg4)
Test the given values.
|
default Predicate4<P1,P2,P3,P4> |
xor(Predicate4<? super P1,? super P2,? super P3,? super P4> other)
Combine this and another predicate with logical exclusive or.
|
static <T1,T2,T3,T4> |
xor(Predicate4<? super T1,? super T2,? super T3,? super T4> pred1,
Predicate4<? super T1,? super T2,? super T3,? super T4> pred2)
Get a predicate which is the combination of two predicates
with a logical exclusive or.
|
boolean test(P1 arg1, P2 arg2, P3 arg3, P4 arg4)
arg1
- function argument 1arg2
- function argument 2arg3
- function argument 3arg4
- function argument 4true
or false
@NotNull default Predicate4<P1,P2,P3,P4> and(@NotNull Predicate4<? super P1,? super P2,? super P3,? super P4> other)
false
the other one is
not evaluated.
This method has a problem if either one of the argument types
pf the parameter is not a super class of this predicate's
parameter types. See and(Predicate4, Predicate4)
for such cases.other
- other predicate to be chained with logical and@NotNull default Predicate4<P1,P2,P3,P4> or(@NotNull Predicate4<? super P1,? super P2,? super P3,? super P4> other)
true
the other one is
not evaluated.
This method has a problem if either one of the argument types
pf the parameter is not a super class of this predicate's
parameter types. See or(Predicate4, Predicate4)
for such cases.other
- other predicate to be chained with logical or@NotNull default Predicate4<P1,P2,P3,P4> xor(@NotNull Predicate4<? super P1,? super P2,? super P3,? super P4> other)
xor(Predicate4, Predicate4)
for such cases.other
- other predicate to be chained with logical exclusive or@NotNull default Predicate4<P1,P2,P3,P4> negate()
@NotNull default Predicate3<P2,P3,P4> partial1(P1 argument)
argument
- value applied for first argument@NotNull default Predicate3<P1,P3,P4> partial2(P2 argument)
argument
- value applied for second argument@NotNull default Predicate3<P1,P2,P4> partial3(P3 argument)
argument
- value applied for third argument@NotNull default Predicate3<P1,P2,P3> partial4(P4 argument)
argument
- value applied for fourth argument@NotNull static <T1,T2,T3,T4> Predicate4<T1,T2,T3,T4> alwaysTrue()
true
.T1
- type of first predicate parameterT2
- type of second predicate parameterT3
- type of third predicate parameterT4
- type of fourth predicate parametertrue
@NotNull static <T1,T2,T3,T4> Predicate4<T1,T2,T3,T4> alwaysFalse()
false
.T1
- type of first predicate parameterT2
- type of second predicate parameterT3
- type of third predicate parameterT4
- type of fourth predicate parameterfalse
@NotNull static <T1,T2,T3,T4> Predicate4<T1,T2,T3,T4> and(@NotNull Predicate4<? super T1,? super T2,? super T3,? super T4> pred1, @NotNull Predicate4<? super T1,? super T2,? super T3,? super T4> pred2)
false
the other one is
not evaluated.T1
- resulting type of first argument,
which is the most extending type of both pred1
's
first argument type and pred2
's first argument type,
so if neither type is extending the
other this method will not compileT2
- resulting type of second argument, see <T1>
for the fine printT3
- resulting type of third argument, see <T1>
for the fine printT4
- resulting type of fourth argument, see <T1>
for the fine printpred1
- first predicatepred2
- second predicateand(Predicate4)
@NotNull static <T1,T2,T3,T4> Predicate4<T1,T2,T3,T4> or(@NotNull Predicate4<? super T1,? super T2,? super T3,? super T4> pred1, @NotNull Predicate4<? super T1,? super T2,? super T3,? super T4> pred2)
true
the other one is
not evaluated.T1
- resulting type of first argument,
which is the most extending type of both pred1
's
first argument type and pred2
's first argument type,
so if neither type is extending the
other this method will not compileT2
- resulting type of second argument, see <T1>
for the fine printT3
- resulting type of third argument, see <T1>
for the fine printT4
- resulting type of fourth argument, see <T1>
for the fine printpred1
- first predicatepred2
- second predicateor(Predicate4)
@NotNull static <T1,T2,T3,T4> Predicate4<T1,T2,T3,T4> xor(@NotNull Predicate4<? super T1,? super T2,? super T3,? super T4> pred1, @NotNull Predicate4<? super T1,? super T2,? super T3,? super T4> pred2)
true
the other one is
not evaluated.T1
- resulting type of first argument,
which is the most extending type of both pred1
's
first argument type and pred2
's first argument type,
so if neither type is extending the
other this method will not compileT2
- resulting type of second argument, see <T1>
for the fine printT3
- resulting type of third argument, see <T1>
for the fine printT4
- resulting type of fourth argument, see <T1>
for the fine printpred1
- first predicatepred2
- second predicatexor(Predicate4)