package o;

import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ob0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2060ob0 implements List, InterfaceC3084zJ {
    public final H90 l;
    public final int m;
    public int n;

    /* renamed from: o, reason: collision with root package name */
    public int f662o;

    public C2060ob0(H90 h90, int i, int i2) {
        this.l = h90;
        this.m = i;
        this.n = ((Ea0) AbstractC2884x90.i(h90.l)).e;
        this.f662o = i2 - i;
    }

    public final void a() {
        if (F3.B(this.l) != this.n) {
            throw new ConcurrentModificationException();
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean add(Object obj) {
        a();
        int i = this.m + this.f662o;
        H90 h90 = this.l;
        h90.add(i, obj);
        this.f662o++;
        this.n = F3.B(h90);
        return true;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean addAll(Collection collection) {
        return addAll(this.f662o, collection);
    }

    @Override // java.util.List, java.util.Collection
    public final void clear() {
        if (this.f662o > 0) {
            a();
            int i = this.f662o;
            int i2 = this.m;
            H90 h90 = this.l;
            h90.d(i2, i + i2);
            this.f662o = 0;
            this.n = F3.B(h90);
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean contains(Object obj) {
        return indexOf(obj) >= 0;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean containsAll(Collection collection) {
        Collection collection2 = collection;
        if ((collection2 instanceof Collection) && collection2.isEmpty()) {
            return true;
        }
        Iterator it = collection2.iterator();
        while (it.hasNext()) {
            if (!contains(it.next())) {
                return false;
            }
        }
        return true;
    }

    @Override // java.util.List
    public final Object get(int i) {
        a();
        F3.b(i, this.f662o);
        return this.l.get(this.m + i);
    }

    @Override // java.util.List
    public final int indexOf(Object obj) {
        a();
        int i = this.f662o;
        int i2 = this.m;
        Iterator it = AbstractC0940cn0.K(i2, i + i2).iterator();
        while (it.hasNext()) {
            int iNextInt = ((C0895cI) it).nextInt();
            if (F3.c(obj, this.l.get(iNextInt))) {
                return iNextInt - i2;
            }
        }
        return -1;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean isEmpty() {
        return this.f662o == 0;
    }

    @Override // java.util.List, java.util.Collection, java.lang.Iterable
    public final Iterator iterator() {
        return listIterator(0);
    }

    @Override // java.util.List
    public final int lastIndexOf(Object obj) {
        a();
        int i = this.f662o;
        int i2 = this.m;
        for (int i3 = (i + i2) - 1; i3 >= i2; i3--) {
            if (F3.c(obj, this.l.get(i3))) {
                return i3 - i2;
            }
        }
        return -1;
    }

    @Override // java.util.List
    public final ListIterator listIterator() {
        return listIterator(0);
    }

    @Override // java.util.List, java.util.Collection
    public final boolean remove(Object obj) {
        int iIndexOf = indexOf(obj);
        if (iIndexOf < 0) {
            return false;
        }
        remove(iIndexOf);
        return true;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean removeAll(Collection collection) {
        Iterator it = collection.iterator();
        while (true) {
            boolean z = false;
            while (it.hasNext()) {
                if (remove(it.next()) || z) {
                    z = true;
                }
            }
            return z;
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean retainAll(Collection collection) {
        int i;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        a();
        H90 h90 = this.l;
        int i2 = this.m;
        int i3 = this.f662o + i2;
        int size = h90.size();
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(h90.l);
                i = ea0.d;
                y = ea0.c;
            }
            NW nwE = y.e();
            nwE.subList(i2, i3).retainAll(collection);
            Y yC = nwE.c();
            if (F3.c(yC, y)) {
                break;
            }
            Ea0 ea02 = h90.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, h90, abstractC2220q90K), i, yC, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, h90);
        } while (!zF);
        int size2 = size - h90.size();
        if (size2 > 0) {
            this.n = ((Ea0) AbstractC2884x90.i(this.l.l)).e;
            this.f662o -= size2;
        }
        return size2 > 0;
    }

    @Override // java.util.List
    public final Object set(int i, Object obj) {
        F3.b(i, this.f662o);
        a();
        int i2 = i + this.m;
        H90 h90 = this.l;
        Object obj2 = h90.set(i2, obj);
        this.n = F3.B(h90);
        return obj2;
    }

    @Override // java.util.List, java.util.Collection
    public final int size() {
        return this.f662o;
    }

    @Override // java.util.List
    public final List subList(int i, int i2) {
        if (!(i >= 0 && i <= i2 && i2 <= this.f662o)) {
            AbstractC1102eY.a("fromIndex or toIndex are out of bounds");
        }
        a();
        int i3 = this.m;
        return new C2060ob0(this.l, i + i3, i2 + i3);
    }

    @Override // java.util.List, java.util.Collection
    public final Object[] toArray() {
        return AbstractC1692kh0.P(this);
    }

    @Override // java.util.List
    public final ListIterator listIterator(int i) {
        a();
        C3058z10 c3058z10 = new C3058z10();
        c3058z10.l = i - 1;
        return new M20(c3058z10, this);
    }

    @Override // java.util.List, java.util.Collection
    public final Object[] toArray(Object[] objArr) {
        return AbstractC1692kh0.Q(this, objArr);
    }

    @Override // java.util.List
    public final boolean addAll(int i, Collection collection) {
        a();
        int i2 = i + this.m;
        H90 h90 = this.l;
        boolean zAddAll = h90.addAll(i2, collection);
        if (zAddAll) {
            this.f662o = collection.size() + this.f662o;
            this.n = F3.B(h90);
        }
        return zAddAll;
    }

    @Override // java.util.List
    public final Object remove(int i) {
        a();
        int i2 = this.m + i;
        H90 h90 = this.l;
        Object objRemove = h90.remove(i2);
        this.f662o--;
        this.n = F3.B(h90);
        return objRemove;
    }

    @Override // java.util.List
    public final void add(int i, Object obj) {
        a();
        int i2 = this.m + i;
        H90 h90 = this.l;
        h90.add(i2, obj);
        this.f662o++;
        this.n = F3.B(h90);
    }
}
