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 TQ implements List, InterfaceC3084zJ {
    public final /* synthetic */ int l;
    public final Object m;
    public final int n;

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

    public /* synthetic */ TQ(List list, int i, int i2, int i3) {
        this.l = i3;
        this.m = list;
        this.n = i;
        this.f341o = i2;
    }

    /* JADX WARN: Type inference failed for: r1v1, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r1v3, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List, java.util.Collection
    public final boolean add(Object obj) {
        switch (this.l) {
            case 0:
                int i = this.f341o;
                this.f341o = i + 1;
                this.m.add(i, obj);
                break;
            default:
                int i2 = this.f341o;
                this.f341o = i2 + 1;
                this.m.add(i2, obj);
                break;
        }
        return true;
    }

    /* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v6, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List
    public final boolean addAll(int i, Collection collection) {
        switch (this.l) {
            case 0:
                this.m.addAll(i + this.n, collection);
                this.f341o = collection.size() + this.f341o;
                if (collection.size() > 0) {
                }
                break;
            default:
                this.m.addAll(i + this.n, collection);
                int size = collection.size();
                this.f341o += size;
                if (size > 0) {
                }
                break;
        }
        return false;
    }

    /* JADX WARN: Type inference failed for: r2v0, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r2v1, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List, java.util.Collection
    public final void clear() {
        switch (this.l) {
            case 0:
                int i = this.f341o - 1;
                int i2 = this.n;
                if (i2 <= i) {
                    while (true) {
                        this.m.remove(i);
                        if (i != i2) {
                            i--;
                        }
                    }
                }
                this.f341o = i2;
                break;
            default:
                int i3 = this.f341o - 1;
                int i4 = this.n;
                if (i4 <= i3) {
                    while (true) {
                        this.m.remove(i3);
                        if (i3 != i4) {
                            i3--;
                        }
                    }
                }
                this.f341o = i4;
                break;
        }
    }

    /* JADX WARN: Type inference failed for: r2v0, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r2v3, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List, java.util.Collection
    public final boolean contains(Object obj) {
        switch (this.l) {
            case 0:
                int i = this.f341o;
                for (int i2 = this.n; i2 < i; i2++) {
                    if (F3.c(this.m.get(i2), obj)) {
                        break;
                    }
                }
                break;
            default:
                int i3 = this.f341o;
                for (int i4 = this.n; i4 < i3; i4++) {
                    if (F3.c(this.m.get(i4), obj)) {
                        break;
                    }
                }
                break;
        }
        return false;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean containsAll(Collection collection) {
        switch (this.l) {
            case 0:
                Iterator it = collection.iterator();
                while (it.hasNext()) {
                    if (!contains(it.next())) {
                        break;
                    }
                }
                break;
            default:
                Iterator it2 = collection.iterator();
                while (it2.hasNext()) {
                    if (!contains(it2.next())) {
                        break;
                    }
                }
                break;
        }
        return true;
    }

    /* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List
    public final Object get(int i) {
        switch (this.l) {
            case 0:
                AbstractC1193fT.a(i, this);
                return this.m.get(i + this.n);
            default:
                AbstractC1573jR.a(i, this);
                return this.m.get(i + this.n);
        }
    }

    /* JADX WARN: Type inference failed for: r3v0, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r3v3, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List
    public final int indexOf(Object obj) {
        switch (this.l) {
            case 0:
                int i = this.f341o;
                int i2 = this.n;
                for (int i3 = i2; i3 < i; i3++) {
                    if (F3.c(this.m.get(i3), obj)) {
                        return i3 - i2;
                    }
                }
                return -1;
            default:
                int i4 = this.f341o;
                int i5 = this.n;
                for (int i6 = i5; i6 < i4; i6++) {
                    if (F3.c(this.m.get(i6), obj)) {
                        return i6 - i5;
                    }
                }
                return -1;
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean isEmpty() {
        switch (this.l) {
            case 0:
                if (this.f341o == this.n) {
                }
                break;
            default:
                if (this.f341o == this.n) {
                }
                break;
        }
        return false;
    }

    @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);
        }
    }

    /* JADX WARN: Type inference failed for: r2v0, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r2v3, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List
    public final int lastIndexOf(Object obj) {
        switch (this.l) {
            case 0:
                int i = this.f341o - 1;
                int i2 = this.n;
                if (i2 <= i) {
                    while (!F3.c(this.m.get(i), obj)) {
                        if (i != i2) {
                            i--;
                        }
                    }
                    return i - i2;
                }
                return -1;
            default:
                int i3 = this.f341o - 1;
                int i4 = this.n;
                if (i4 <= i3) {
                    while (!F3.c(this.m.get(i3), obj)) {
                        if (i3 != i4) {
                            i3--;
                        }
                    }
                    return i3 - i4;
                }
                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);
        }
    }

    /* JADX WARN: Type inference failed for: r2v0, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r2v1, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List, java.util.Collection
    public final boolean remove(Object obj) {
        switch (this.l) {
            case 0:
                int i = this.f341o;
                for (int i2 = this.n; i2 < i; i2++) {
                    ?? r2 = this.m;
                    if (F3.c(r2.get(i2), obj)) {
                        r2.remove(i2);
                        this.f341o--;
                        break;
                    }
                }
                break;
            default:
                int i3 = this.f341o;
                for (int i4 = this.n; i4 < i3; i4++) {
                    ?? r22 = this.m;
                    if (F3.c(r22.get(i4), obj)) {
                        r22.remove(i4);
                        this.f341o--;
                        break;
                    }
                }
                break;
        }
        return true;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean removeAll(Collection collection) {
        switch (this.l) {
            case 0:
                int i = this.f341o;
                Iterator it = collection.iterator();
                while (it.hasNext()) {
                    remove(it.next());
                }
                if (i != this.f341o) {
                }
                break;
            default:
                int i2 = this.f341o;
                Iterator it2 = collection.iterator();
                while (it2.hasNext()) {
                    remove(it2.next());
                }
                if (i2 != this.f341o) {
                }
                break;
        }
        return false;
    }

    /* JADX WARN: Type inference failed for: r3v0, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r3v3, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List, java.util.Collection
    public final boolean retainAll(Collection collection) {
        switch (this.l) {
            case 0:
                int i = this.f341o;
                int i2 = i - 1;
                int i3 = this.n;
                if (i3 <= i2) {
                    while (true) {
                        ?? r3 = this.m;
                        if (!collection.contains(r3.get(i2))) {
                            r3.remove(i2);
                            this.f341o--;
                        }
                        if (i2 != i3) {
                            i2--;
                        }
                    }
                }
                if (i != this.f341o) {
                }
                break;
            default:
                int i4 = this.f341o;
                int i5 = i4 - 1;
                int i6 = this.n;
                if (i6 <= i5) {
                    while (true) {
                        ?? r32 = this.m;
                        if (!collection.contains(r32.get(i5))) {
                            r32.remove(i5);
                            this.f341o--;
                        }
                        if (i5 != i6) {
                            i5--;
                        }
                    }
                }
                if (i4 != this.f341o) {
                }
                break;
        }
        return false;
    }

    /* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List
    public final Object set(int i, Object obj) {
        switch (this.l) {
            case 0:
                AbstractC1193fT.a(i, this);
                return this.m.set(i + this.n, obj);
            default:
                AbstractC1573jR.a(i, this);
                return this.m.set(i + this.n, obj);
        }
    }

    @Override // java.util.List, java.util.Collection
    public final int size() {
        int i;
        int i2;
        switch (this.l) {
            case 0:
                i = this.f341o;
                i2 = this.n;
                break;
            default:
                i = this.f341o;
                i2 = this.n;
                break;
        }
        return i - i2;
    }

    @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);
    }

    /* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List
    public final void add(int i, Object obj) {
        switch (this.l) {
            case 0:
                this.m.add(i + this.n, obj);
                this.f341o++;
                break;
            default:
                this.m.add(i + this.n, obj);
                this.f341o++;
                break;
        }
    }

    @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, java.util.Collection
    public final Object[] toArray(Object[] objArr) {
        switch (this.l) {
        }
        return AbstractC1692kh0.Q(this, objArr);
    }

    /* JADX WARN: Type inference failed for: r0v1, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v3, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List, java.util.Collection
    public final boolean addAll(Collection collection) {
        switch (this.l) {
            case 0:
                this.m.addAll(this.f341o, collection);
                this.f341o = collection.size() + this.f341o;
                if (collection.size() > 0) {
                }
                break;
            default:
                this.m.addAll(this.f341o, collection);
                int size = collection.size();
                this.f341o += size;
                if (size > 0) {
                }
                break;
        }
        return false;
    }

    /* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v6, types: [java.lang.Object, java.util.List] */
    @Override // java.util.List
    public final Object remove(int i) {
        switch (this.l) {
            case 0:
                AbstractC1193fT.a(i, this);
                this.f341o--;
                return this.m.remove(i + this.n);
            default:
                AbstractC1573jR.a(i, this);
                this.f341o--;
                return this.m.remove(i + this.n);
        }
    }
}
