package o; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.RandomAccess; /* loaded from: classes.dex */ public class gaE extends gaB { public static final boolean d(Collection collection, Iterable iterable) { C14957gcv.e(collection, ""); C14957gcv.e(iterable, ""); if (iterable instanceof Collection) { return collection.addAll((Collection) iterable); } Iterator it = iterable.iterator(); boolean z = false; while (it.hasNext()) { if (collection.add(it.next())) { z = true; } } return z; } /* JADX WARN: Type inference failed for: r6v1, types: [java.lang.Object] */ public static final boolean c(List list, InterfaceC14894gbR interfaceC14894gbR) { boolean z = false; if (!(list instanceof RandomAccess)) { C14957gcv.d(list, ""); Iterator it = gcQ.d(list).iterator(); while (it.hasNext()) { if (interfaceC14894gbR.invoke(it.next()).booleanValue()) { it.remove(); z = true; } } return z; } C14957gcv.e(list, ""); C14973gde c14973gde = new C14973gde(0, list.size() - 1); C14972gdd c14972gdd = new C14972gdd(c14973gde.b, c14973gde.d, c14973gde.e); int i = 0; while (c14972gdd.hasNext()) { int a = c14972gdd.a(); ?? r6 = list.get(a); if (!interfaceC14894gbR.invoke(r6).booleanValue()) { if (i != a) { list.set(i, r6); } i++; } } if (i >= list.size()) { return false; } C14957gcv.e(list, ""); int size = list.size() - 1; if (i <= size) { while (true) { list.remove(size); if (size == i) { break; } size--; } } return true; } }