package com.google.android.gms.internal.firebase_ml; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; /* loaded from: classes2.dex */ final class zzvc extends zzsq implements zzun, zzwa, RandomAccess { private static final zzvc zzbqh; private int size; private long[] zzbqi; zzvc() { this(new long[10], 0); } private zzvc(long[] jArr, int i) { this.zzbqi = jArr; this.size = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zzpu(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } long[] jArr = this.zzbqi; System.arraycopy(jArr, i2, jArr, 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 zzvc)) { return super.equals(obj); } zzvc zzvcVar = (zzvc) obj; if (this.size != zzvcVar.size) { return false; } long[] jArr = zzvcVar.zzbqi; for (int i = 0; i < this.size; i++) { if (this.zzbqi[i] != jArr[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) + zzug.zzz(this.zzbqi[i2]); } return i; } public final long getLong(int i) { zzci(i); return this.zzbqi[i]; } public final void zzaa(long j) { zzk(this.size, j); } private final void zzk(int i, long j) { int i2; zzpu(); if (i < 0 || i > (i2 = this.size)) { throw new IndexOutOfBoundsException(zzcj(i)); } long[] jArr = this.zzbqi; if (i2 < jArr.length) { System.arraycopy(jArr, i, jArr, i + 1, i2 - i); } else { long[] jArr2 = new long[((i2 * 3) / 2) + 1]; System.arraycopy(jArr, 0, jArr2, 0, i); System.arraycopy(this.zzbqi, i, jArr2, i + 1, this.size - i); this.zzbqi = jArr2; } this.zzbqi[i] = j; 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 zzvc)) { return super.addAll(collection); } zzvc zzvcVar = (zzvc) collection; int i = zzvcVar.size; if (i == 0) { return false; } int i2 = this.size; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; long[] jArr = this.zzbqi; if (i3 > jArr.length) { this.zzbqi = Arrays.copyOf(jArr, i3); } System.arraycopy(zzvcVar.zzbqi, 0, this.zzbqi, this.size, zzvcVar.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(Long.valueOf(this.zzbqi[i]))) { long[] jArr = this.zzbqi; System.arraycopy(jArr, i + 1, jArr, 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) { long longValue = ((Long) obj).longValue(); zzpu(); zzci(i); long[] jArr = this.zzbqi; long j = jArr[i]; jArr[i] = longValue; return Long.valueOf(j); } @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); long[] jArr = this.zzbqi; long j = jArr[i]; if (i < this.size - 1) { System.arraycopy(jArr, i + 1, jArr, i, (r3 - i) - 1); } this.size--; this.modCount++; return Long.valueOf(j); } @Override // com.google.android.gms.internal.firebase_ml.zzsq, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { zzk(i, ((Long) obj).longValue()); } @Override // com.google.android.gms.internal.firebase_ml.zzun public final /* synthetic */ zzun zzck(int i) { if (i < this.size) { throw new IllegalArgumentException(); } return new zzvc(Arrays.copyOf(this.zzbqi, i), this.size); } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { return Long.valueOf(getLong(i)); } static { zzvc zzvcVar = new zzvc(new long[0], 0); zzbqh = zzvcVar; zzvcVar.zzpt(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.size; } }