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

t T
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

other Predicate<? 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

other Predicate<? super T>
the second test

Returns

the composed test

isEqual

public static <T> Predicate<T> isEqual(Object targetRef)
Passes for values equal to targetRef by Object.equals, or for null when targetRef is null.

Parameters

targetRef Object
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

target Predicate<? super T>
the test to negate
<T>
the input type

Returns

the negated test