53 lines
1.4 KiB
Java
53 lines
1.4 KiB
Java
package com.squareup.haha.guava.base;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Collection;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Predicates {
|
|
|
|
static class InPredicate<T> implements Predicate<T>, Serializable {
|
|
private final Collection<?> target;
|
|
|
|
/* synthetic */ InPredicate(Collection collection, byte b) {
|
|
this(collection);
|
|
}
|
|
|
|
@Override // com.squareup.haha.guava.base.Predicate
|
|
public final boolean apply(T t) {
|
|
try {
|
|
return this.target.contains(t);
|
|
} catch (ClassCastException | NullPointerException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (obj instanceof InPredicate) {
|
|
return this.target.equals(((InPredicate) obj).target);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return this.target.hashCode();
|
|
}
|
|
|
|
public final String toString() {
|
|
return "Predicates.in(" + this.target + ")";
|
|
}
|
|
|
|
private InPredicate(Collection<?> collection) {
|
|
this.target = (Collection) Joiner.checkNotNull(collection);
|
|
}
|
|
}
|
|
|
|
static {
|
|
new Joiner(",");
|
|
}
|
|
|
|
public static <T> Predicate<T> in(Collection<? extends T> collection) {
|
|
return new InPredicate(collection, (byte) 0);
|
|
}
|
|
}
|