package defpackage;

import defpackage.d04;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes2.dex */
class e04 implements Iterator<Object> {
    public int a;
    public int b;
    public int c;
    public int d;
    public final /* synthetic */ d04.h e;

    public e04(d04.h hVar) {
        this.e = hVar;
        d04 d04Var = hVar.a;
        this.a = d04Var.k;
        this.b = -1;
        this.c = d04Var.d;
        this.d = d04Var.c;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        if (this.e.a.d == this.c) {
            return this.a != -2 && this.d > 0;
        }
        throw new ConcurrentModificationException();
    }

    @Override // java.util.Iterator
    public final Object next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        int i = this.a;
        d04.h hVar = this.e;
        Object objA = hVar.a(i);
        int i2 = this.a;
        this.b = i2;
        this.a = hVar.a.n[i2];
        this.d--;
        return objA;
    }

    @Override // java.util.Iterator
    public final void remove() {
        d04.h hVar = this.e;
        d04 d04Var = hVar.a;
        if (hVar.a.d != this.c) {
            throw new ConcurrentModificationException();
        }
        k41.d(this.b != -1);
        int i = this.b;
        d04Var.j(i, v04.c(d04Var.a[i]));
        if (this.a == d04Var.c) {
            this.a = this.b;
        }
        this.b = -1;
        this.c = d04Var.d;
    }
}
