Top Description Inners Constructors Methods
com.google.common.base

public final Class Predicates

extends Object
Class Inheritance
Annotations
@GwtCompatible
emulated:true
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

Static utility methods pertaining to Predicate instances.

All methods return serializable predicates as long as they're given serializable parameters.

See the Guava User Guide article on the use of Predicate.

Author
Kevin Bourrillion
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
pack-priv static enum
private static class
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T extends @Nullable Object> Predicate<T>
alwaysFalse()

Returns a predicate that always evaluates to false.

public static <T extends @Nullable Object> Predicate<T>
alwaysTrue()

Returns a predicate that always evaluates to true.

public static <T extends @Nullable Object> Predicate<T>
and(Iterable<? extends Predicate<? super T>> components)

Returns a predicate that evaluates to true if each of its components evaluates to true.

public static <T extends @Nullable Object> Predicate<T>
and(Predicate<? super T>... components)

Returns a predicate that evaluates to true if each of its components evaluates to true.

public static <T extends @Nullable Object> Predicate<T>
and(Predicate<? super T> first, Predicate<? super T> second)

Returns a predicate that evaluates to true if both of its components evaluate to true.

private static <T extends @Nullable Object> List<Predicate<? super T>>
asList(Predicate<? super T> first, Predicate<? super T> second)

public static <A extends @Nullable Object, B extends @Nullable Object> Predicate<A>

Returns:

the composition of the provided function and predicate
compose
(Predicate<B> predicate, Function<A, ? extends B> function)

Returns the composition of a function and a predicate.

public static Predicate<CharSequence>
contains(Pattern pattern)

Returns a predicate that evaluates to true if the CharSequence being tested contains any match for the given regular expression pattern.

public static Predicate<CharSequence>
containsPattern(String pattern)

Returns a predicate that evaluates to true if the CharSequence being tested contains any match for the given regular expression pattern.

private static <T> List<T>
defensiveCopy(T... array)

pack-priv static <T> List<T>
defensiveCopy(Iterable<T> iterable)

public static <T extends @Nullable Object> Predicate<T>
equalTo(T target)

Returns a predicate that evaluates to true if the object being tested equals() the given target or both are null.

public static <T extends @Nullable Object> Predicate<T>
in(Collection<? extends T>
the collection that may contain the function input
target
)

Returns a predicate that evaluates to true if the object reference being tested is a member of the given collection.

public static <T extends @Nullable Object> Predicate<T>
instanceOf(Class<?> clazz)

Returns a predicate that evaluates to true if the object being tested is an instance of the given class.

public static <T extends @Nullable Object> Predicate<T>
isNull()

Returns a predicate that evaluates to true if the object reference being tested is null.

public static <T extends @Nullable Object> Predicate<T>
not(Predicate<T> predicate)

Returns a predicate that evaluates to true if the given predicate evaluates to false.

public static <T extends @Nullable Object> Predicate<T>
notNull()

Returns a predicate that evaluates to true if the object reference being tested is not null.

public static <T extends @Nullable Object> Predicate<T>
or(Iterable<? extends Predicate<? super T>> components)

Returns a predicate that evaluates to true if any one of its components evaluates to true.

public static <T extends @Nullable Object> Predicate<T>
or(Predicate<? super T>... components)

Returns a predicate that evaluates to true if any one of its components evaluates to true.

public static <T extends @Nullable Object> Predicate<T>
or(Predicate<? super T> first, Predicate<? super T> second)

Returns a predicate that evaluates to true if either of its components evaluates to true.

public static Predicate<Class<?>>
subtypeOf(Class<?> clazz)

Returns a predicate that evaluates to true if the class being tested is assignable to (is a subtype of) clazz.

private static String
toStringHelper(String methodName, Iterable<?> components)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait