package com.google.android.gms.internal.firebase_ml; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class zzuf extends zzsq implements zzul, zzwa, RandomAccess { private static final zzuf zzbpc; private int size; private int[] zzbpd; zzuf() { this(new int[10], 0); } private zzuf(int[] iArr, int i) { this.zzbpd = iArr; this.size = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zzpu(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } int[] iArr = this.zzbpd; System.arraycopy(iArr, i2, iArr, i, this.size - i2); this.size -= i2 - i; this.modCount++; } @Override // com.google.android.gms.internal.firebase_ml.zzsq, java.util.AbstractList, java.util.Collection, java.util.List public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof zzuf)) { return super.equals(obj); } zzuf zzufVar = (zzuf) obj; if (this.size != zzufVar.size) { return false; } int[] iArr = zzufVar.zzbpd; for (int i = 0; i < this.size; i++) { if (this.zzbpd[i] != iArr[i]) { return false; } } return true; } @Override // com.google.android.gms.internal.firebase_ml.zzsq, 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.zzbpd[i2]; } return i; } @Override // com.google.android.gms.internal.firebase_ml.zzun /* renamed from: zzdg, reason: merged with bridge method [inline-methods] */ public final zzul zzck(int i) { if (i < this.size) { throw new IllegalArgumentException(); } return new zzuf(Arrays.copyOf(this.zzbpd, i), this.size); } public final int getInt(int i) { zzci(i); return this.zzbpd[i]; } @Override // com.google.android.gms.internal.firebase_ml.zzul public final void zzdh(int i) { zzt(this.size, i); } private final void zzt(int i, int i2) { int i3; zzpu(); if (i < 0 || i > (i3 = this.size)) { throw new IndexOutOfBoundsException(zzcj(i)); } int[] iArr = this.zzbpd; 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.zzbpd, i, iArr2, i + 1, this.size - i); this.zzbpd = iArr2; } this.zzbpd[i] = i2; this.size++; this.modCount++; } @Override // com.google.android.gms.internal.firebase_ml.zzsq, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { zzpu(); zzug.checkNotNull(collection); if (!(collection instanceof zzuf)) { return super.addAll(collection); } zzuf zzufVar = (zzuf) collection; int i = zzufVar.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.zzbpd; if (i3 > iArr.length) { this.zzbpd = Arrays.copyOf(iArr, i3); } System.arraycopy(zzufVar.zzbpd, 0, this.zzbpd, this.size, zzufVar.size); this.size = i3; this.modCount++; return true; } @Override // com.google.android.gms.internal.firebase_ml.zzsq, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean remove(Object obj) { zzpu(); for (int i = 0; i < this.size; i++) { if (obj.equals(Integer.valueOf(this.zzbpd[i]))) { int[] iArr = this.zzbpd; System.arraycopy(iArr, i + 1, iArr, i, (this.size - i) - 1); this.size--; this.modCount++; return true; } } return false; } private final void zzci(int i) { if (i < 0 || i >= this.size) { throw new IndexOutOfBoundsException(zzcj(i)); } } private final String zzcj(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.firebase_ml.zzsq, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { int intValue = ((Integer) obj).intValue(); zzpu(); zzci(i); int[] iArr = this.zzbpd; int i2 = iArr[i]; iArr[i] = intValue; return Integer.valueOf(i2); } @Override // com.google.android.gms.internal.firebase_ml.zzsq, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zzpu(); zzci(i); int[] iArr = this.zzbpd; 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.firebase_ml.zzsq, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { zzt(i, ((Integer) obj).intValue()); } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { return Integer.valueOf(getInt(i)); } static { zzuf zzufVar = new zzuf(new int[0], 0); zzbpc = zzufVar; zzufVar.zzpt(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.size; } public static zzuf zzrl() { return zzbpc; } }