package o;

import java.util.NoSuchElementException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class OW extends S {
    public final Object[] n;

    /* renamed from: o, reason: collision with root package name */
    public final Zg0 f268o;

    public OW(int i, int i2, int i3, Object[] objArr, Object[] objArr2) {
        super(i, i2);
        this.n = objArr2;
        int i4 = (i2 - 1) & (-32);
        this.f268o = new Zg0(objArr, i > i4 ? i4 : i, i4, i3);
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final Object next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        Zg0 zg0 = this.f268o;
        if (zg0.hasNext()) {
            this.l++;
            return zg0.next();
        }
        int i = this.l;
        this.l = i + 1;
        return this.n[i - zg0.m];
    }

    @Override // java.util.ListIterator
    public final Object previous() {
        if (!hasPrevious()) {
            throw new NoSuchElementException();
        }
        int i = this.l;
        Zg0 zg0 = this.f268o;
        int i2 = zg0.m;
        if (i <= i2) {
            this.l = i - 1;
            return zg0.previous();
        }
        int i3 = i - 1;
        this.l = i3;
        return this.n[i3 - i2];
    }
}
