package com.google.android.gms.internal.vision; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; /* loaded from: classes2.dex */ final class zzfz extends zzef implements zzge, zzhr, RandomAccess { private static final zzfz zzxl; private int size; private int[] zzxm; zzfz() { this(new int[10], 0); } private zzfz(int[] iArr, int i) { this.zzxm = iArr; this.size = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zzcj(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } int[] iArr = this.zzxm; System.arraycopy(iArr, i2, iArr, i, this.size - i2); this.size -= i2 - i; this.modCount++; } @Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractList, java.util.Collection, java.util.List public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof zzfz)) { return super.equals(obj); } zzfz zzfzVar = (zzfz) obj; if (this.size != zzfzVar.size) { return false; } int[] iArr = zzfzVar.zzxm; for (int i = 0; i < this.size; i++) { if (this.zzxm[i] != iArr[i]) { return false; } } return true; } @Override // com.google.android.gms.internal.vision.zzef, 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.zzxm[i2]; } return i; } public final int getInt(int i) { zzaf(i); return this.zzxm[i]; } public final void zzbg(int i) { zzq(this.size, i); } private final void zzq(int i, int i2) { int i3; zzcj(); if (i < 0 || i > (i3 = this.size)) { throw new IndexOutOfBoundsException(zzag(i)); } int[] iArr = this.zzxm; 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.zzxm, i, iArr2, i + 1, this.size - i); this.zzxm = iArr2; } this.zzxm[i] = i2; this.size++; this.modCount++; } @Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { zzcj(); zzga.checkNotNull(collection); if (!(collection instanceof zzfz)) { return super.addAll(collection); } zzfz zzfzVar = (zzfz) collection; int i = zzfzVar.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.zzxm; if (i3 > iArr.length) { this.zzxm = Arrays.copyOf(iArr, i3); } System.arraycopy(zzfzVar.zzxm, 0, this.zzxm, this.size, zzfzVar.size); this.size = i3; this.modCount++; return true; } @Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean remove(Object obj) { zzcj(); for (int i = 0; i < this.size; i++) { if (obj.equals(Integer.valueOf(this.zzxm[i]))) { int[] iArr = this.zzxm; System.arraycopy(iArr, i + 1, iArr, i, this.size - i); this.size--; this.modCount++; return true; } } return false; } private final void zzaf(int i) { if (i < 0 || i >= this.size) { throw new IndexOutOfBoundsException(zzag(i)); } } private final String zzag(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.vision.zzef, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { int intValue = ((Integer) obj).intValue(); zzcj(); zzaf(i); int[] iArr = this.zzxm; int i2 = iArr[i]; iArr[i] = intValue; return Integer.valueOf(i2); } @Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zzcj(); zzaf(i); int[] iArr = this.zzxm; int i2 = iArr[i]; int i3 = this.size; if (i < i3 - 1) { System.arraycopy(iArr, i + 1, iArr, i, i3 - i); } this.size--; this.modCount++; return Integer.valueOf(i2); } @Override // com.google.android.gms.internal.vision.zzef, 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.vision.zzge public final /* synthetic */ zzge zzah(int i) { if (i < this.size) { throw new IllegalArgumentException(); } return new zzfz(Arrays.copyOf(this.zzxm, i), this.size); } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { return Integer.valueOf(getInt(i)); } static { zzfz zzfzVar = new zzfz(); zzxl = zzfzVar; zzfzVar.zzci(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.size; } }