package com.google.android.gms.internal.gtm; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; /* loaded from: classes2.dex */ final class zzrd extends zzpo implements zzrj, zzsv, RandomAccess { private static final zzrd zzbbf; private int size; private int[] zzbbg; zzrd() { this(new int[10], 0); } private zzrd(int[] iArr, int i) { this.zzbbg = iArr; this.size = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zzmz(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } int[] iArr = this.zzbbg; System.arraycopy(iArr, i2, iArr, i, this.size - i2); this.size -= i2 - i; this.modCount++; } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractList, java.util.Collection, java.util.List public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof zzrd)) { return super.equals(obj); } zzrd zzrdVar = (zzrd) obj; if (this.size != zzrdVar.size) { return false; } int[] iArr = zzrdVar.zzbbg; for (int i = 0; i < this.size; i++) { if (this.zzbbg[i] != iArr[i]) { return false; } } return true; } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractList, java.util.Collection, java.util.List public final int hashCode() { int i = 1; for (int i2 = 0; i2 < this.size; i2++) { i = (i * 31) + this.zzbbg[i2]; } return i; } public final int getInt(int i) { zzah(i); return this.zzbbg[i]; } public final void zzbm(int i) { zzq(this.size, i); } private final void zzq(int i, int i2) { int i3; zzmz(); if (i < 0 || i > (i3 = this.size)) { throw new IndexOutOfBoundsException(zzai(i)); } int[] iArr = this.zzbbg; if (i3 < iArr.length) { System.arraycopy(iArr, i, iArr, i + 1, i3 - i); } else { int[] iArr2 = new int[((i3 * 3) / 2) + 1]; System.arraycopy(iArr, 0, iArr2, 0, i); System.arraycopy(this.zzbbg, i, iArr2, i + 1, this.size - i); this.zzbbg = iArr2; } this.zzbbg[i] = i2; this.size++; this.modCount++; } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { zzmz(); zzre.checkNotNull(collection); if (!(collection instanceof zzrd)) { return super.addAll(collection); } zzrd zzrdVar = (zzrd) collection; int i = zzrdVar.size; if (i == 0) { return false; } int i2 = this.size; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; int[] iArr = this.zzbbg; if (i3 > iArr.length) { this.zzbbg = Arrays.copyOf(iArr, i3); } System.arraycopy(zzrdVar.zzbbg, 0, this.zzbbg, this.size, zzrdVar.size); this.size = i3; this.modCount++; return true; } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean remove(Object obj) { zzmz(); for (int i = 0; i < this.size; i++) { if (obj.equals(Integer.valueOf(this.zzbbg[i]))) { int[] iArr = this.zzbbg; System.arraycopy(iArr, i + 1, iArr, i, (this.size - i) - 1); this.size--; this.modCount++; return true; } } return false; } private final void zzah(int i) { if (i < 0 || i >= this.size) { throw new IndexOutOfBoundsException(zzai(i)); } } private final String zzai(int i) { int i2 = this.size; StringBuilder sb = new StringBuilder(35); sb.append("Index:"); sb.append(i); sb.append(", Size:"); sb.append(i2); return sb.toString(); } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { int intValue = ((Integer) obj).intValue(); zzmz(); zzah(i); int[] iArr = this.zzbbg; int i2 = iArr[i]; iArr[i] = intValue; return Integer.valueOf(i2); } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zzmz(); zzah(i); int[] iArr = this.zzbbg; int i2 = iArr[i]; if (i < this.size - 1) { System.arraycopy(iArr, i + 1, iArr, i, (r2 - i) - 1); } this.size--; this.modCount++; return Integer.valueOf(i2); } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { zzq(i, ((Integer) obj).intValue()); } @Override // com.google.android.gms.internal.gtm.zzrj public final /* synthetic */ zzrj zzaj(int i) { if (i < this.size) { throw new IllegalArgumentException(); } return new zzrd(Arrays.copyOf(this.zzbbg, i), this.size); } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { return Integer.valueOf(getInt(i)); } static { zzrd zzrdVar = new zzrd(new int[0], 0); zzbbf = zzrdVar; zzrdVar.zzmi(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.size; } public static zzrd zzpo() { return zzbbf; } }