package o;

import java.util.List;
import java.util.ListIterator;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class M20 implements ListIterator, InterfaceC2989yJ {
    public final /* synthetic */ int l = 0;
    public final Object m;
    public final /* synthetic */ Object n;

    public M20(HN hn, int i) {
        this.n = hn;
        List list = (List) hn.m;
        if (i >= 0 && i <= hn.a()) {
            this.m = list.listIterator(hn.a() - i);
            return;
        }
        StringBuilder sbO = AbstractC0126Ew.o(i, "Position index ", " must be in range [");
        sbO.append(new C0991dI(0, hn.a(), 1));
        sbO.append("].");
        throw new IndexOutOfBoundsException(sbO.toString());
    }

    @Override // java.util.ListIterator
    public final void add(Object obj) {
        switch (this.l) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            default:
                throw new IllegalStateException("Cannot modify a state list through an iterator");
        }
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final boolean hasNext() {
        switch (this.l) {
            case 0:
                return ((ListIterator) this.m).hasPrevious();
            default:
                return ((C3058z10) this.m).l < ((C2060ob0) this.n).f662o - 1;
        }
    }

    @Override // java.util.ListIterator
    public final boolean hasPrevious() {
        switch (this.l) {
            case 0:
                return ((ListIterator) this.m).hasNext();
            default:
                return ((C3058z10) this.m).l >= 0;
        }
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final Object next() {
        switch (this.l) {
            case 0:
                return ((ListIterator) this.m).previous();
            default:
                C3058z10 c3058z10 = (C3058z10) this.m;
                int i = c3058z10.l + 1;
                C2060ob0 c2060ob0 = (C2060ob0) this.n;
                F3.b(i, c2060ob0.f662o);
                c3058z10.l = i;
                return c2060ob0.get(i);
        }
    }

    @Override // java.util.ListIterator
    public final int nextIndex() {
        switch (this.l) {
            case 0:
                HN hn = (HN) this.n;
                return AbstractC0008Ai.R(hn) - ((ListIterator) this.m).previousIndex();
            default:
                return ((C3058z10) this.m).l + 1;
        }
    }

    @Override // java.util.ListIterator
    public final Object previous() {
        switch (this.l) {
            case 0:
                return ((ListIterator) this.m).next();
            default:
                C3058z10 c3058z10 = (C3058z10) this.m;
                int i = c3058z10.l;
                C2060ob0 c2060ob0 = (C2060ob0) this.n;
                F3.b(i, c2060ob0.f662o);
                c3058z10.l = i - 1;
                return c2060ob0.get(i);
        }
    }

    @Override // java.util.ListIterator
    public final int previousIndex() {
        switch (this.l) {
            case 0:
                HN hn = (HN) this.n;
                return AbstractC0008Ai.R(hn) - ((ListIterator) this.m).nextIndex();
            default:
                return ((C3058z10) this.m).l;
        }
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final void remove() {
        switch (this.l) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            default:
                throw new IllegalStateException("Cannot modify a state list through an iterator");
        }
    }

    @Override // java.util.ListIterator
    public final void set(Object obj) {
        switch (this.l) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            default:
                throw new IllegalStateException("Cannot modify a state list through an iterator");
        }
    }

    public M20(C3058z10 c3058z10, C2060ob0 c2060ob0) {
        this.m = c3058z10;
        this.n = c2060ob0;
    }
}
