package o;

import java.util.AbstractMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.m90, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1840m90 implements Iterator {
    public final /* synthetic */ int l;
    public int m;
    public boolean n;

    /* renamed from: o, reason: collision with root package name */
    public Iterator f633o;
    public final /* synthetic */ AbstractMap p;

    public /* synthetic */ C1840m90(C2193pu0 c2193pu0) {
        this.l = 1;
        Objects.requireNonNull(c2193pu0);
        this.p = c2193pu0;
        this.m = -1;
    }

    public Iterator a() {
        if (this.f633o == null) {
            this.f633o = ((C1650k90) this.p).m.entrySet().iterator();
        }
        return this.f633o;
    }

    public Iterator b() {
        if (this.f633o == null) {
            this.f633o = ((C2193pu0) this.p).n.entrySet().iterator();
        }
        return this.f633o;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        switch (this.l) {
            case 0:
                int i = this.m + 1;
                C1650k90 c1650k90 = (C1650k90) this.p;
                if (i >= c1650k90.l.size()) {
                    return !c1650k90.m.isEmpty() && a().hasNext();
                }
                return true;
            default:
                int i2 = this.m + 1;
                C2193pu0 c2193pu0 = (C2193pu0) this.p;
                if (i2 >= c2193pu0.m) {
                    return !c2193pu0.n.isEmpty() && b().hasNext();
                }
                return true;
        }
    }

    @Override // java.util.Iterator
    public final Object next() {
        switch (this.l) {
            case 0:
                this.n = true;
                int i = this.m + 1;
                this.m = i;
                C1650k90 c1650k90 = (C1650k90) this.p;
                return i < c1650k90.l.size() ? (Map.Entry) c1650k90.l.get(this.m) : (Map.Entry) a().next();
            default:
                this.n = true;
                int i2 = this.m + 1;
                this.m = i2;
                C2193pu0 c2193pu0 = (C2193pu0) this.p;
                return i2 < c2193pu0.m ? (C2288qu0) c2193pu0.l[i2] : (Map.Entry) b().next();
        }
    }

    @Override // java.util.Iterator
    public final void remove() {
        int i = this.l;
        AbstractMap abstractMap = this.p;
        switch (i) {
            case 0:
                C1650k90 c1650k90 = (C1650k90) abstractMap;
                if (!this.n) {
                    throw new IllegalStateException("remove() was called before next()");
                }
                this.n = false;
                int i2 = C1650k90.q;
                c1650k90.b();
                if (this.m >= c1650k90.l.size()) {
                    a().remove();
                    return;
                }
                int i3 = this.m;
                this.m = i3 - 1;
                c1650k90.h(i3);
                return;
            default:
                if (!this.n) {
                    throw new IllegalStateException("remove() was called before next()");
                }
                this.n = false;
                C2193pu0 c2193pu0 = (C2193pu0) abstractMap;
                c2193pu0.f();
                int i4 = this.m;
                if (i4 >= c2193pu0.m) {
                    b().remove();
                    return;
                } else {
                    this.m = i4 - 1;
                    c2193pu0.d(i4);
                    return;
                }
        }
    }

    public C1840m90(C1650k90 c1650k90) {
        this.l = 0;
        this.p = c1650k90;
        this.m = -1;
    }
}
