Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
@FunctionalInterface
public interface Predicate<T>
A test of one value.
Type parameters
<T>- the input type
Methods
public abstract boolean test(T t) | Whether t passes. |
public default Predicate<T> and(Predicate<? super T> other) | Passes when this and other both pass; other is not asked when this fails. |
public default Predicate<T> negate() | Passes when this fails. |
public default Predicate<T> or(Predicate<? super T> other) | Passes when this or other passes; other is not asked when this passes. |
public static <T> Predicate<T> isEqual(Object targetRef) | Passes for values equal to targetRef by Object.equals, or for null when targetRef is null. |
public static <T> Predicate<T> not(Predicate<? super T> target) | The negation of target. |
Method details
test
public abstract boolean test(T t)Whether
t passes.Parameters
tT- the input
Returns
true when it passes
and
public default Predicate<T> and(Predicate<? super T> other)Passes when this and
other both pass; other is not asked when this
fails.Parameters
otherPredicate<? super T>- the second test
Returns
the composed test
negate
public default Predicate<T> negate()Passes when this fails.
Returns
the negated test
or
public default Predicate<T> or(Predicate<? super T> other)Passes when this or
other passes; other is not asked when this
passes.Parameters
otherPredicate<? super T>- the second test
Returns
the composed test
isEqual
public static <T> Predicate<T> isEqual(Object targetRef)Parameters
targetRefObject- the value to compare with
<T>- the input type
Returns
the test
not
public static <T> Predicate<T> not(Predicate<? super T> target)The negation of
target.Parameters
targetPredicate<? super T>- the test to negate
<T>- the input type
Returns
the negated test