Class Predicates
java.lang.Object
org.glassfish.jersey.internal.guava.Predicates
Static utility methods pertaining to
Predicate
instances.
All methods returns serializable predicates as long as they're given serializable parameters.
See the Guava User Guide article on the
use of Predicate
.
- Since:
- 2.0 (imported from Google Collections Library)
- Author:
- Kevin Bourrillion
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Predicate<T>
Returns a predicate that always evaluates totrue
.static <A,
B> Predicate<A> Returns the composition of a function and a predicate.static <T> Predicate<T>
equalTo
(T target) Returns a predicate that evaluates totrue
if the object being testedequals()
the given target or both are null.static <T> Predicate<T>
in
(Collection<? extends T> target) Returns a predicate that evaluates totrue
if the object reference being tested is a member of the given collection.static <T> Predicate<T>
Returns a predicate that evaluates totrue
if the given predicate evaluates tofalse
.
-
Method Details
-
alwaysTrue
Returns a predicate that always evaluates totrue
. -
not
Returns a predicate that evaluates totrue
if the given predicate evaluates tofalse
. -
equalTo
Returns a predicate that evaluates totrue
if the object being testedequals()
the given target or both are null. -
in
Returns a predicate that evaluates totrue
if the object reference being tested is a member of the given collection. It does not defensively copy the collection passed in, so future changes to it will alter the behavior of the predicate.This method can technically accept any
Collection<?>
, but using a typed collection helps prevent bugs. This approach doesn't block any potential users since it is always possible to usePredicates.<Object>in()
.- Parameters:
target
- the collection that may contain the function input
-
compose
Returns the composition of a function and a predicate. For everyx
, the generated predicate returnspredicate(function(x))
.- Returns:
- the composition of the provided function and predicate
-