package o;

import java.util.AbstractList;
import java.util.Arrays;
import java.util.RandomAccess;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.uZ, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2625uZ extends AbstractC0676a0 implements RandomAccess {

    /* renamed from: o, reason: collision with root package name */
    public static final C2625uZ f746o = new C2625uZ(new Object[0], 0, false);
    public Object[] m;
    public int n;

    public C2625uZ(Object[] objArr, int i, boolean z) {
        this.l = z;
        this.m = objArr;
        this.n = i;
    }

    @Override // java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
    public final boolean add(Object obj) {
        a();
        int i = this.n;
        Object[] objArr = this.m;
        if (i == objArr.length) {
            this.m = Arrays.copyOf(objArr, ((i * 3) / 2) + 1);
        }
        Object[] objArr2 = this.m;
        int i2 = this.n;
        this.n = i2 + 1;
        objArr2[i2] = obj;
        ((AbstractList) this).modCount++;
        return true;
    }

    public final void b(int i) {
        if (i < 0 || i >= this.n) {
            StringBuilder sbO = AbstractC0126Ew.o(i, "Index:", ", Size:");
            sbO.append(this.n);
            throw new IndexOutOfBoundsException(sbO.toString());
        }
    }

    public final C2625uZ c(int i) {
        if (i >= this.n) {
            return new C2625uZ(Arrays.copyOf(this.m, i), this.n, true);
        }
        throw new IllegalArgumentException();
    }

    @Override // java.util.AbstractList, java.util.List
    public final Object get(int i) {
        b(i);
        return this.m[i];
    }

    @Override // o.AbstractC0676a0, java.util.AbstractList, java.util.List
    public final Object remove(int i) {
        a();
        b(i);
        Object[] objArr = this.m;
        Object obj = objArr[i];
        if (i < this.n - 1) {
            System.arraycopy(objArr, i + 1, objArr, i, (r2 - i) - 1);
        }
        this.n--;
        ((AbstractList) this).modCount++;
        return obj;
    }

    @Override // java.util.AbstractList, java.util.List
    public final Object set(int i, Object obj) {
        a();
        b(i);
        Object[] objArr = this.m;
        Object obj2 = objArr[i];
        objArr[i] = obj;
        ((AbstractList) this).modCount++;
        return obj2;
    }

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

    @Override // java.util.AbstractList, java.util.List
    public final void add(int i, Object obj) {
        int i2;
        a();
        if (i >= 0 && i <= (i2 = this.n)) {
            Object[] objArr = this.m;
            if (i2 < objArr.length) {
                System.arraycopy(objArr, i, objArr, i + 1, i2 - i);
            } else {
                Object[] objArr2 = new Object[((i2 * 3) / 2) + 1];
                System.arraycopy(objArr, 0, objArr2, 0, i);
                System.arraycopy(this.m, i, objArr2, i + 1, this.n - i);
                this.m = objArr2;
            }
            this.m[i] = obj;
            this.n++;
            ((AbstractList) this).modCount++;
            return;
        }
        StringBuilder sbO = AbstractC0126Ew.o(i, "Index:", ", Size:");
        sbO.append(this.n);
        throw new IndexOutOfBoundsException(sbO.toString());
    }
}
