59 lines
1.6 KiB
Java
59 lines
1.6 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import com.google.common.base.Predicates;
|
|
import java.util.Collection;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Collections2 {
|
|
static boolean a(Collection<?> collection, Object obj) {
|
|
Preconditions.a(collection);
|
|
try {
|
|
return collection.contains(obj);
|
|
} catch (ClassCastException | NullPointerException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static boolean b(Collection<?> collection, Object obj) {
|
|
Preconditions.a(collection);
|
|
try {
|
|
return collection.remove(obj);
|
|
} catch (ClassCastException | NullPointerException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static boolean a(Collection<?> collection, Collection<?> collection2) {
|
|
return Iterables.a((Iterable) collection2, Predicates.a((Collection) collection));
|
|
}
|
|
|
|
static String a(Collection<?> collection) {
|
|
StringBuilder a = a(collection.size());
|
|
a.append('[');
|
|
boolean z = true;
|
|
for (Object obj : collection) {
|
|
if (!z) {
|
|
a.append(", ");
|
|
}
|
|
z = false;
|
|
if (obj == collection) {
|
|
a.append("(this Collection)");
|
|
} else {
|
|
a.append(obj);
|
|
}
|
|
}
|
|
a.append(']');
|
|
return a.toString();
|
|
}
|
|
|
|
static StringBuilder a(int i) {
|
|
CollectPreconditions.a(i, "size");
|
|
return new StringBuilder((int) Math.min(i * 8, 1073741824L));
|
|
}
|
|
|
|
static <T> Collection<T> a(Iterable<T> iterable) {
|
|
return (Collection) iterable;
|
|
}
|
|
}
|