package o;

import java.util.ConcurrentModificationException;
import java.util.NoSuchElementException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class DW extends CW {

    /* renamed from: o, reason: collision with root package name */
    public final C3002yW f77o;
    public Object p;
    public boolean q;
    public int r;

    public DW(C3002yW c3002yW, AbstractC0833bh0[] abstractC0833bh0Arr) {
        super(c3002yW.m, abstractC0833bh0Arr);
        this.f77o = c3002yW;
        this.r = c3002yW.f806o;
    }

    public final void c(int i, C0737ah0 c0737ah0, Object obj, int i2) {
        int i3 = i2 * 5;
        AbstractC0833bh0[] abstractC0833bh0Arr = this.l;
        if (i3 <= 30) {
            int iV = 1 << AbstractC1155f00.v(i, i3);
            if (c0737ah0.h(iV)) {
                abstractC0833bh0Arr[i2].a(c0737ah0.d, Integer.bitCount(c0737ah0.a) * 2, c0737ah0.f(iV));
                this.m = i2;
                return;
            } else {
                int iT = c0737ah0.t(iV);
                C0737ah0 c0737ah0S = c0737ah0.s(iT);
                abstractC0833bh0Arr[i2].a(c0737ah0.d, Integer.bitCount(c0737ah0.a) * 2, iT);
                c(i, c0737ah0S, obj, i2 + 1);
                return;
            }
        }
        AbstractC0833bh0 abstractC0833bh0 = abstractC0833bh0Arr[i2];
        Object[] objArr = c0737ah0.d;
        abstractC0833bh0.a(objArr, objArr.length, 0);
        while (true) {
            AbstractC0833bh0 abstractC0833bh02 = abstractC0833bh0Arr[i2];
            if (F3.c(abstractC0833bh02.l[abstractC0833bh02.n], obj)) {
                this.m = i2;
                return;
            } else {
                abstractC0833bh0Arr[i2].n += 2;
            }
        }
    }

    @Override // o.CW, java.util.Iterator
    public final Object next() {
        if (this.f77o.f806o != this.r) {
            throw new ConcurrentModificationException();
        }
        if (!this.n) {
            throw new NoSuchElementException();
        }
        AbstractC0833bh0 abstractC0833bh0 = this.l[this.m];
        this.p = abstractC0833bh0.l[abstractC0833bh0.n];
        this.q = true;
        return super.next();
    }

    @Override // o.CW, java.util.Iterator
    public final void remove() {
        if (!this.q) {
            throw new IllegalStateException();
        }
        boolean z = this.n;
        C3002yW c3002yW = this.f77o;
        if (!z) {
            AbstractC1692kh0.j(c3002yW).remove(this.p);
        } else {
            if (!z) {
                throw new NoSuchElementException();
            }
            AbstractC0833bh0 abstractC0833bh0 = this.l[this.m];
            Object obj = abstractC0833bh0.l[abstractC0833bh0.n];
            AbstractC1692kh0.j(c3002yW).remove(this.p);
            c(obj != null ? obj.hashCode() : 0, c3002yW.m, obj, 0);
        }
        this.p = null;
        this.q = false;
        this.r = c3002yW.f806o;
    }
}
