package o;

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

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class SQ implements List, InterfaceC3084zJ {
    public final /* synthetic */ int l;
    public final Object m;

    public /* synthetic */ SQ(int i, Object obj) {
        this.l = i;
        this.m = obj;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean add(Object obj) {
        switch (this.l) {
            case 0:
                ((UQ) this.m).a(obj);
                break;
            default:
                ((C1479iR) this.m).b(obj);
                break;
        }
        return true;
    }

    @Override // java.util.List
    public final boolean addAll(int i, Collection collection) {
        switch (this.l) {
            case 0:
                UQ uq = (UQ) this.m;
                if (i < 0 || i > uq.b) {
                    StringBuilder sbO = AbstractC0126Ew.o(i, "Index ", " must be in 0..");
                    sbO.append(uq.b);
                    AbstractC2841wm0.J(sbO.toString());
                    throw null;
                }
                int i2 = 0;
                if (collection.isEmpty()) {
                    return false;
                }
                int size = collection.size() + uq.b;
                Object[] objArr = uq.a;
                if (objArr.length < size) {
                    uq.l(size, objArr);
                }
                Object[] objArr2 = uq.a;
                if (i != uq.b) {
                    AbstractC2219q9.J(collection.size() + i, i, uq.b, objArr2, objArr2);
                }
                for (Object obj : collection) {
                    int i3 = i2 + 1;
                    if (i2 < 0) {
                        AbstractC0008Ai.V();
                        throw null;
                    }
                    objArr2[i2 + i] = obj;
                    i2 = i3;
                }
                uq.b = collection.size() + uq.b;
                return true;
            default:
                return ((C1479iR) this.m).e(i, collection);
        }
    }

    @Override // java.util.List, java.util.Collection
    public final void clear() {
        switch (this.l) {
            case 0:
                ((UQ) this.m).c();
                break;
            default:
                ((C1479iR) this.m).h();
                break;
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean contains(Object obj) {
        switch (this.l) {
            case 0:
                return ((UQ) this.m).f(obj) >= 0;
            default:
                return ((C1479iR) this.m).i(obj);
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean containsAll(Collection collection) {
        switch (this.l) {
            case 0:
                UQ uq = (UQ) this.m;
                Iterator it = collection.iterator();
                while (it.hasNext()) {
                    if (uq.f(it.next()) < 0) {
                        break;
                    }
                }
                break;
            default:
                C1479iR c1479iR = (C1479iR) this.m;
                c1479iR.getClass();
                Iterator it2 = collection.iterator();
                while (it2.hasNext()) {
                    if (!c1479iR.i(it2.next())) {
                        break;
                    }
                }
                break;
        }
        return true;
    }

    @Override // java.util.List
    public final Object get(int i) {
        switch (this.l) {
            case 0:
                AbstractC1193fT.a(i, this);
                return ((UQ) this.m).e(i);
            default:
                AbstractC1573jR.a(i, this);
                return ((C1479iR) this.m).l[i];
        }
    }

    @Override // java.util.List
    public final int indexOf(Object obj) {
        switch (this.l) {
            case 0:
                return ((UQ) this.m).f(obj);
            default:
                C1479iR c1479iR = (C1479iR) this.m;
                Object[] objArr = c1479iR.l;
                int i = c1479iR.n;
                for (int i2 = 0; i2 < i; i2++) {
                    if (F3.c(obj, objArr[i2])) {
                        return i2;
                    }
                }
                return -1;
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean isEmpty() {
        switch (this.l) {
            case 0:
                return ((UQ) this.m).g();
            default:
                return ((C1479iR) this.m).n == 0;
        }
    }

    @Override // java.util.List, java.util.Collection, java.lang.Iterable
    public final Iterator iterator() {
        switch (this.l) {
            case 0:
                return new RQ(this, 0, 0);
            default:
                return new RQ(this, 0, 1);
        }
    }

    @Override // java.util.List
    public final int lastIndexOf(Object obj) {
        int i;
        switch (this.l) {
            case 0:
                UQ uq = (UQ) this.m;
                if (obj == null) {
                    Object[] objArr = uq.a;
                    i = uq.b - 1;
                    while (-1 < i) {
                        if (objArr[i] != null) {
                            i--;
                        }
                    }
                    return -1;
                }
                Object[] objArr2 = uq.a;
                i = uq.b - 1;
                while (-1 < i) {
                    if (!obj.equals(objArr2[i])) {
                        i--;
                    }
                }
                return -1;
                return i;
            default:
                C1479iR c1479iR = (C1479iR) this.m;
                Object[] objArr3 = c1479iR.l;
                for (int i2 = c1479iR.n - 1; i2 >= 0; i2--) {
                    if (F3.c(obj, objArr3[i2])) {
                        return i2;
                    }
                }
                return -1;
        }
    }

    @Override // java.util.List
    public final ListIterator listIterator() {
        switch (this.l) {
            case 0:
                return new RQ(this, 0, 0);
            default:
                return new RQ(this, 0, 1);
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean remove(Object obj) {
        switch (this.l) {
            case 0:
                return ((UQ) this.m).i(obj);
            default:
                return ((C1479iR) this.m).j(obj);
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean removeAll(Collection collection) {
        switch (this.l) {
            case 0:
                UQ uq = (UQ) this.m;
                int i = uq.b;
                Iterator it = collection.iterator();
                while (it.hasNext()) {
                    uq.i(it.next());
                }
                if (i != uq.b) {
                }
                break;
            default:
                C1479iR c1479iR = (C1479iR) this.m;
                c1479iR.getClass();
                if (!collection.isEmpty()) {
                    int i2 = c1479iR.n;
                    Iterator it2 = collection.iterator();
                    while (it2.hasNext()) {
                        c1479iR.j(it2.next());
                    }
                    if (i2 != c1479iR.n) {
                    }
                }
                break;
        }
        return false;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean retainAll(Collection collection) {
        switch (this.l) {
            case 0:
                UQ uq = (UQ) this.m;
                int i = uq.b;
                Object[] objArr = uq.a;
                for (int i2 = i - 1; -1 < i2; i2--) {
                    if (!collection.contains(objArr[i2])) {
                        uq.j(i2);
                    }
                }
                if (i != uq.b) {
                }
                break;
            default:
                C1479iR c1479iR = (C1479iR) this.m;
                int i3 = c1479iR.n;
                for (int i4 = i3 - 1; -1 < i4; i4--) {
                    if (!collection.contains(c1479iR.l[i4])) {
                        c1479iR.k(i4);
                    }
                }
                if (i3 != c1479iR.n) {
                }
                break;
        }
        return false;
    }

    @Override // java.util.List
    public final Object set(int i, Object obj) {
        switch (this.l) {
            case 0:
                AbstractC1193fT.a(i, this);
                UQ uq = (UQ) this.m;
                if (i < 0 || i >= uq.b) {
                    uq.m(i);
                    throw null;
                }
                Object[] objArr = uq.a;
                Object obj2 = objArr[i];
                objArr[i] = obj;
                return obj2;
            default:
                AbstractC1573jR.a(i, this);
                Object[] objArr2 = ((C1479iR) this.m).l;
                Object obj3 = objArr2[i];
                objArr2[i] = obj;
                return obj3;
        }
    }

    @Override // java.util.List, java.util.Collection
    public final int size() {
        switch (this.l) {
            case 0:
                return ((UQ) this.m).b;
            default:
                return ((C1479iR) this.m).n;
        }
    }

    @Override // java.util.List
    public final List subList(int i, int i2) {
        switch (this.l) {
            case 0:
                AbstractC1193fT.b(this, i, i2);
                return new TQ(this, i, i2, 0);
            default:
                AbstractC1573jR.b(this, i, i2);
                return new TQ(this, i, i2, 1);
        }
    }

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

    @Override // java.util.List
    public final void add(int i, Object obj) {
        int i2;
        switch (this.l) {
            case 0:
                UQ uq = (UQ) this.m;
                if (i >= 0 && i <= (i2 = uq.b)) {
                    int i3 = i2 + 1;
                    Object[] objArr = uq.a;
                    if (objArr.length < i3) {
                        uq.l(i3, objArr);
                    }
                    Object[] objArr2 = uq.a;
                    int i4 = uq.b;
                    if (i != i4) {
                        AbstractC2219q9.J(i + 1, i, i4, objArr2, objArr2);
                    }
                    objArr2[i] = obj;
                    uq.b++;
                    return;
                }
                StringBuilder sbO = AbstractC0126Ew.o(i, "Index ", " must be in 0..");
                sbO.append(uq.b);
                AbstractC2841wm0.J(sbO.toString());
                throw null;
            default:
                ((C1479iR) this.m).a(i, obj);
                return;
        }
    }

    @Override // java.util.List
    public final ListIterator listIterator(int i) {
        switch (this.l) {
            case 0:
                return new RQ(this, i, 0);
            default:
                return new RQ(this, i, 1);
        }
    }

    @Override // java.util.List
    public final Object remove(int i) {
        switch (this.l) {
            case 0:
                AbstractC1193fT.a(i, this);
                return ((UQ) this.m).j(i);
            default:
                AbstractC1573jR.a(i, this);
                return ((C1479iR) this.m).k(i);
        }
    }

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

    @Override // java.util.List, java.util.Collection
    public final boolean addAll(Collection collection) {
        switch (this.l) {
            case 0:
                UQ uq = (UQ) this.m;
                int i = uq.b;
                Iterator it = collection.iterator();
                while (it.hasNext()) {
                    uq.a(it.next());
                }
                return i != uq.b;
            default:
                C1479iR c1479iR = (C1479iR) this.m;
                return c1479iR.e(c1479iR.n, collection);
        }
    }
}
