package ra; import java.util.Collection; import java.util.Iterator; import java.util.NoSuchElementException; import qa.g; import qa.h; /* compiled from: Iterators.java */ /* loaded from: classes4.dex */ public final class y { /* compiled from: Iterators.java */ /* loaded from: classes4.dex */ static class a extends u0 { /* renamed from: j reason: collision with root package name */ boolean f21799j; /* renamed from: k reason: collision with root package name */ final /* synthetic */ Object f21800k; a(Object obj) { this.f21800k = obj; } @Override // java.util.Iterator public boolean hasNext() { return !this.f21799j; } @Override // java.util.Iterator public T next() { if (!this.f21799j) { this.f21799j = true; return this.f21800k; } throw new NoSuchElementException(); } } /* compiled from: Iterators.java */ /* loaded from: classes4.dex */ private static final class b extends a { /* renamed from: n reason: collision with root package name */ static final v0 f21801n = new b(new Object[0], 0, 0, 0); /* renamed from: l reason: collision with root package name */ private final T[] f21802l; /* renamed from: m reason: collision with root package name */ private final int f21803m; b(T[] tArr, int i10, int i11, int i12) { super(i11, i12); this.f21802l = tArr; this.f21803m = i10; } @Override // ra.a protected T b(int i10) { return this.f21802l[this.f21803m + i10]; } } /* compiled from: Iterators.java */ /* loaded from: classes4.dex */ private enum c implements Iterator { INSTANCE; @Override // java.util.Iterator public boolean hasNext() { return false; } @Override // java.util.Iterator public Object next() { throw new NoSuchElementException(); } @Override // java.util.Iterator public void remove() { i.c(false); } } /* JADX WARN: Multi-variable type inference failed */ public static boolean a(Collection collection, Iterator it) { h.j(collection); h.j(it); boolean z10 = false; while (it.hasNext()) { z10 |= collection.add(it.next()); } return z10; } static void b(Iterator it) { h.j(it); while (it.hasNext()) { it.next(); it.remove(); } } /* JADX WARN: Removed duplicated region for block: B:4:0x0006 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static boolean c(Iterator it, Iterator it2) { while (it.hasNext()) { if (!it2.hasNext() || !g.a(it.next(), it2.next())) { return false; } while (it.hasNext()) { } } return !it2.hasNext(); } static u0 d() { return e(); } static v0 e() { return (v0) b.f21801n; } static Iterator f() { return c.INSTANCE; } public static T g(Iterator it) { T next; do { next = it.next(); } while (it.hasNext()); return next; } public static T h(Iterator it, T t10) { return it.hasNext() ? (T) it.next() : t10; } static T i(Iterator it) { if (!it.hasNext()) { return null; } T next = it.next(); it.remove(); return next; } public static boolean j(Iterator it, Collection collection) { h.j(collection); boolean z10 = false; while (it.hasNext()) { if (collection.contains(it.next())) { it.remove(); z10 = true; } } return z10; } public static u0 k(T t10) { return new a(t10); } public static String l(Iterator it) { StringBuilder sb2 = new StringBuilder(); sb2.append('['); boolean z10 = true; while (it.hasNext()) { if (!z10) { sb2.append(", "); } z10 = false; sb2.append(it.next()); } sb2.append(']'); return sb2.toString(); } }