package C3;

import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import n4.u0;
import v0.AbstractC1664c;

/* JADX INFO: loaded from: classes.dex */
public final class r implements Iterator {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f1293q;

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

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public int f1295s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final /* synthetic */ C0058u f1296t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ int f1297u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final /* synthetic */ C0058u f1298v;

    public r(C0058u c0058u, int i) {
        this.f1297u = i;
        this.f1298v = c0058u;
        this.f1296t = c0058u;
        this.f1293q = c0058u.f1309u;
        this.f1294r = c0058u.isEmpty() ? -1 : 0;
        this.f1295s = -1;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        return this.f1294r >= 0;
    }

    @Override // java.util.Iterator
    public final Object next() {
        Object c0057t;
        C0058u c0058u = this.f1296t;
        if (c0058u.f1309u != this.f1293q) {
            throw new ConcurrentModificationException();
        }
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        int i = this.f1294r;
        this.f1295s = i;
        switch (this.f1297u) {
            case u0.f15495q /* 0 */:
                c0057t = this.f1298v.i()[i];
                break;
            case 1:
                c0057t = new C0057t(this.f1298v, i);
                break;
            default:
                c0057t = this.f1298v.j()[i];
                break;
        }
        int i5 = this.f1294r + 1;
        if (i5 >= c0058u.f1310v) {
            i5 = -1;
        }
        this.f1294r = i5;
        return c0057t;
    }

    @Override // java.util.Iterator
    public final void remove() {
        C0058u c0058u = this.f1296t;
        if (c0058u.f1309u != this.f1293q) {
            throw new ConcurrentModificationException();
        }
        AbstractC1664c.j("no calls to next() since the last call to remove()", this.f1295s >= 0);
        this.f1293q += 32;
        c0058u.remove(c0058u.i()[this.f1295s]);
        this.f1294r--;
        this.f1295s = -1;
    }
}
