package o;

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

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

    /* renamed from: o, reason: collision with root package name */
    public static final Object[] f547o;
    public static final C1337gu0 p;
    public Object[] m;
    public int n;

    static {
        Object[] objArr = new Object[0];
        f547o = objArr;
        p = new C1337gu0(objArr, 0, false);
    }

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

    @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)) {
            throw new IndexOutOfBoundsException(Rs0.a(this.n, i, (byte) 13, "Index:", ", Size:"));
        }
        int i3 = i + 1;
        Object[] objArr = this.m;
        int length = objArr.length;
        if (i2 < length) {
            System.arraycopy(objArr, i, objArr, i3, i2 - i);
        } else {
            Object[] objArr2 = new Object[Math.max(((length * 3) / 2) + 1, 10)];
            System.arraycopy(this.m, 0, objArr2, 0, i);
            System.arraycopy(this.m, i, objArr2, i3, this.n - i);
            this.m = objArr2;
        }
        this.m[i] = obj;
        this.n++;
        ((AbstractList) this).modCount++;
    }

    public final void b(int i) {
        if (i < 0 || i >= this.n) {
            throw new IndexOutOfBoundsException(Rs0.a(this.n, i, (byte) 13, "Index:", ", Size:"));
        }
    }

    @Override // o.Dt0
    public final /* bridge */ /* synthetic */ Dt0 g(int i) {
        if (i >= this.n) {
            return new C1337gu0(i == 0 ? f547o : 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.Ps0, 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.AbstractCollection, java.util.Collection, java.util.List
    public final boolean add(Object obj) {
        a();
        int i = this.n;
        int length = this.m.length;
        if (i == length) {
            this.m = Arrays.copyOf(this.m, Math.max(((length * 3) / 2) + 1, 10));
        }
        Object[] objArr = this.m;
        int i2 = this.n;
        this.n = i2 + 1;
        objArr[i2] = obj;
        ((AbstractList) this).modCount++;
        return true;
    }
}
