package androidx.navigation;

import java.util.Iterator;
import java.util.NoSuchElementException;
import n.AbstractC2593u;
import n.e0;

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

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ E f12654c;

    public D(E e6) {
        this.f12654c = e6;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        return this.f12652a + 1 < this.f12654c.f12656m.e();
    }

    @Override // java.util.Iterator
    public final Object next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        this.f12653b = true;
        e0 e0Var = this.f12654c.f12656m;
        int i6 = this.f12652a + 1;
        this.f12652a = i6;
        return (B) e0Var.f(i6);
    }

    @Override // java.util.Iterator
    public final void remove() {
        if (!this.f12653b) {
            throw new IllegalStateException("You must call next() before you can remove an element");
        }
        E e6 = this.f12654c;
        int i6 = this.f12652a;
        e0 e0Var = e6.f12656m;
        ((B) e0Var.f(i6)).f12640b = null;
        int i7 = this.f12652a;
        Object[] objArr = e0Var.f21422c;
        Object obj = objArr[i7];
        Object obj2 = AbstractC2593u.f21480c;
        if (obj != obj2) {
            objArr[i7] = obj2;
            e0Var.f21420a = true;
        }
        this.f12652a = i7 - 1;
        this.f12653b = false;
    }
}
