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

import java.nio.charset.Charset;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.RandomAccess;

/* JADX INFO: loaded from: classes2.dex */
public final class e6 extends o5 implements j6, z6, RandomAccess {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final int[] f20176d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final e6 f20177e;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int[] f20178b;

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

    static {
        int[] iArr = new int[0];
        f20176d = iArr;
        f20177e = new e6(iArr, 0, false);
    }

    public e6(int[] iArr, int i10, boolean z10) {
        super(z10);
        this.f20178b = iArr;
        this.f20179c = i10;
    }

    @Override // java.util.AbstractList, java.util.List
    public final void add(int i10, Object obj) {
        int i11;
        int iIntValue = ((Integer) obj).intValue();
        zza();
        if (i10 < 0 || i10 > (i11 = this.f20179c)) {
            throw new IndexOutOfBoundsException(defpackage.e.f("Index:", i10, ", Size:", this.f20179c));
        }
        int[] iArr = this.f20178b;
        if (i11 < iArr.length) {
            System.arraycopy(iArr, i10, iArr, i10 + 1, i11 - i10);
        } else {
            int[] iArr2 = new int[com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.c(iArr.length, 3, 2, 1, 10)];
            System.arraycopy(this.f20178b, 0, iArr2, 0, i10);
            System.arraycopy(this.f20178b, i10, iArr2, i10 + 1, this.f20179c - i10);
            this.f20178b = iArr2;
        }
        this.f20178b[i10] = iIntValue;
        this.f20179c++;
        ((AbstractList) this).modCount++;
    }

    @Override // com.google.android.gms.internal.measurement.o5, java.util.AbstractCollection, java.util.Collection, java.util.List
    public final boolean addAll(Collection collection) {
        zza();
        Charset charset = d6.f20163a;
        collection.getClass();
        if (!(collection instanceof e6)) {
            return super.addAll(collection);
        }
        e6 e6Var = (e6) collection;
        int i10 = e6Var.f20179c;
        if (i10 == 0) {
            return false;
        }
        int i11 = this.f20179c;
        if (Integer.MAX_VALUE - i11 < i10) {
            throw new OutOfMemoryError();
        }
        int i12 = i11 + i10;
        int[] iArr = this.f20178b;
        if (i12 > iArr.length) {
            this.f20178b = Arrays.copyOf(iArr, i12);
        }
        System.arraycopy(e6Var.f20178b, 0, this.f20178b, this.f20179c, e6Var.f20179c);
        this.f20179c = i12;
        ((AbstractList) this).modCount++;
        return true;
    }

    public final int c(int i10) {
        i(i10);
        return this.f20178b[i10];
    }

    @Override // java.util.AbstractCollection, java.util.Collection, java.util.List
    public final boolean contains(Object obj) {
        return indexOf(obj) != -1;
    }

    @Override // com.google.android.gms.internal.measurement.o5, java.util.AbstractList, java.util.Collection, java.util.List
    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof e6)) {
            return super.equals(obj);
        }
        e6 e6Var = (e6) obj;
        if (this.f20179c != e6Var.f20179c) {
            return false;
        }
        int[] iArr = e6Var.f20178b;
        for (int i10 = 0; i10 < this.f20179c; i10++) {
            if (this.f20178b[i10] != iArr[i10]) {
                return false;
            }
        }
        return true;
    }

    @Override // com.google.android.gms.internal.measurement.k6
    /* JADX INFO: renamed from: f, reason: merged with bridge method [inline-methods] */
    public final e6 zza(int i10) {
        if (i10 >= this.f20179c) {
            return new e6(i10 == 0 ? f20176d : Arrays.copyOf(this.f20178b, i10), this.f20179c, true);
        }
        throw new IllegalArgumentException();
    }

    public final void g(int i10) {
        zza();
        int i11 = this.f20179c;
        int[] iArr = this.f20178b;
        if (i11 == iArr.length) {
            int[] iArr2 = new int[com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.c(iArr.length, 3, 2, 1, 10)];
            System.arraycopy(this.f20178b, 0, iArr2, 0, this.f20179c);
            this.f20178b = iArr2;
        }
        int[] iArr3 = this.f20178b;
        int i12 = this.f20179c;
        this.f20179c = i12 + 1;
        iArr3[i12] = i10;
    }

    @Override // java.util.AbstractList, java.util.List
    public final /* synthetic */ Object get(int i10) {
        return Integer.valueOf(c(i10));
    }

    public final void h(int i10) {
        int[] iArr = this.f20178b;
        if (i10 <= iArr.length) {
            return;
        }
        if (iArr.length == 0) {
            this.f20178b = new int[Math.max(i10, 10)];
            return;
        }
        int length = iArr.length;
        while (length < i10) {
            length = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.c(length, 3, 2, 1, 10);
        }
        this.f20178b = Arrays.copyOf(this.f20178b, length);
    }

    @Override // com.google.android.gms.internal.measurement.o5, java.util.AbstractList, java.util.Collection, java.util.List
    public final int hashCode() {
        int i10 = 1;
        for (int i11 = 0; i11 < this.f20179c; i11++) {
            i10 = (i10 * 31) + this.f20178b[i11];
        }
        return i10;
    }

    public final void i(int i10) {
        if (i10 < 0 || i10 >= this.f20179c) {
            throw new IndexOutOfBoundsException(defpackage.e.f("Index:", i10, ", Size:", this.f20179c));
        }
    }

    @Override // java.util.AbstractList, java.util.List
    public final int indexOf(Object obj) {
        if (!(obj instanceof Integer)) {
            return -1;
        }
        int iIntValue = ((Integer) obj).intValue();
        int i10 = this.f20179c;
        for (int i11 = 0; i11 < i10; i11++) {
            if (this.f20178b[i11] == iIntValue) {
                return i11;
            }
        }
        return -1;
    }

    @Override // com.google.android.gms.internal.measurement.o5, java.util.AbstractList, java.util.List
    public final /* synthetic */ Object remove(int i10) {
        zza();
        i(i10);
        int[] iArr = this.f20178b;
        int i11 = iArr[i10];
        if (i10 < this.f20179c - 1) {
            System.arraycopy(iArr, i10 + 1, iArr, i10, (r2 - i10) - 1);
        }
        this.f20179c--;
        ((AbstractList) this).modCount++;
        return Integer.valueOf(i11);
    }

    @Override // java.util.AbstractList
    public final void removeRange(int i10, int i11) {
        zza();
        if (i11 < i10) {
            throw new IndexOutOfBoundsException("toIndex < fromIndex");
        }
        int[] iArr = this.f20178b;
        System.arraycopy(iArr, i11, iArr, i10, this.f20179c - i11);
        this.f20179c -= i11 - i10;
        ((AbstractList) this).modCount++;
    }

    @Override // java.util.AbstractList, java.util.List
    public final /* synthetic */ Object set(int i10, Object obj) {
        int iIntValue = ((Integer) obj).intValue();
        zza();
        i(i10);
        int[] iArr = this.f20178b;
        int i11 = iArr[i10];
        iArr[i10] = iIntValue;
        return Integer.valueOf(i11);
    }

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

    @Override // java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
    public final /* synthetic */ boolean add(Object obj) {
        g(((Integer) obj).intValue());
        return true;
    }
}
