package com.google.android.gms.internal.measurement;

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

/* JADX INFO: renamed from: com.google.android.gms.internal.measurement.y2, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0728y2 extends N1 implements RandomAccess {

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public static final Object[] f10078t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public static final C0728y2 f10079u;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public Object[] f10080r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public int f10081s;

    static {
        Object[] objArr = new Object[0];
        f10078t = objArr;
        f10079u = new C0728y2(objArr, 0, false);
    }

    public C0728y2(Object[] objArr, int i, boolean z8) {
        super(z8);
        this.f10080r = objArr;
        this.f10081s = i;
    }

    @Override // java.util.AbstractList, java.util.List
    public final void add(int i, Object obj) {
        int i5;
        a();
        if (i < 0 || i > (i5 = this.f10081s)) {
            throw new IndexOutOfBoundsException(I1.a.o("Index:", i, this.f10081s, ", Size:"));
        }
        int i8 = i + 1;
        Object[] objArr = this.f10080r;
        int length = objArr.length;
        if (i5 < length) {
            System.arraycopy(objArr, i, objArr, i8, i5 - i);
        } else {
            Object[] objArr2 = new Object[Math.max(((length * 3) / 2) + 1, 10)];
            System.arraycopy(this.f10080r, 0, objArr2, 0, i);
            System.arraycopy(this.f10080r, i, objArr2, i8, this.f10081s - i);
            this.f10080r = objArr2;
        }
        this.f10080r[i] = obj;
        this.f10081s++;
        ((AbstractList) this).modCount++;
    }

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

    @Override // com.google.android.gms.internal.measurement.InterfaceC0639g2
    public final /* bridge */ /* synthetic */ InterfaceC0639g2 e(int i) {
        if (i >= this.f10081s) {
            return new C0728y2(i == 0 ? f10078t : Arrays.copyOf(this.f10080r, i), this.f10081s, true);
        }
        throw new IllegalArgumentException();
    }

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

    @Override // com.google.android.gms.internal.measurement.N1, java.util.AbstractList, java.util.List
    public final Object remove(int i) {
        a();
        b(i);
        Object[] objArr = this.f10080r;
        Object obj = objArr[i];
        if (i < this.f10081s - 1) {
            System.arraycopy(objArr, i + 1, objArr, i, (r2 - i) - 1);
        }
        this.f10081s--;
        ((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.f10080r;
        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.f10081s;
    }

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