package E1;

import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes.dex */
public final class C implements Iterator, Q6.a {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f1987q = -1;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public boolean f1988r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ D f1989s;

    public C(D d8) {
        this.f1989s = d8;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        return this.f1987q + 1 < this.f1989s.f1990A.k();
    }

    @Override // java.util.Iterator
    public final Object next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        this.f1988r = true;
        q.j jVar = this.f1989s.f1990A;
        int i = this.f1987q + 1;
        this.f1987q = i;
        Object objL = jVar.l(i);
        P6.g.d(objL, "nodes.valueAt(++index)");
        return (A) objL;
    }

    @Override // java.util.Iterator
    public final void remove() {
        if (!this.f1988r) {
            throw new IllegalStateException("You must call next() before you can remove an element");
        }
        D d8 = this.f1989s;
        int i = this.f1987q;
        q.j jVar = d8.f1990A;
        ((A) jVar.l(i)).f1979r = null;
        int i5 = this.f1987q;
        Object[] objArr = jVar.f16193s;
        Object obj = objArr[i5];
        Object obj2 = q.h.f16187b;
        if (obj != obj2) {
            objArr[i5] = obj2;
            jVar.f16191q = true;
        }
        this.f1987q = i5 - 1;
        this.f1988r = false;
    }
}
