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 zzgt extends zzef implements zzge, zzhr, RandomAccess { private static final zzgt zzyq; private int size; private long[] zzyr; zzgt() { this(new long[10], 0); } private zzgt(long[] jArr, int i) { this.zzyr = jArr; this.size = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zzcj(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } long[] jArr = this.zzyr; System.arraycopy(jArr, i2, jArr, 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 zzgt)) { return super.equals(obj); } zzgt zzgtVar = (zzgt) obj; if (this.size != zzgtVar.size) { return false; } long[] jArr = zzgtVar.zzyr; for (int i = 0; i < this.size; i++) { if (this.zzyr[i] != jArr[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) + zzga.zzo(this.zzyr[i2]); } return i; } public final long getLong(int i) { zzaf(i); return this.zzyr[i]; } public final void zzp(long j) { zzk(this.size, j); } private final void zzk(int i, long j) { int i2; zzcj(); if (i < 0 || i > (i2 = this.size)) { throw new IndexOutOfBoundsException(zzag(i)); } long[] jArr = this.zzyr; 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.zzyr, i, jArr2, i + 1, this.size - i); this.zzyr = jArr2; } this.zzyr[i] = j; 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 zzgt)) { return super.addAll(collection); } zzgt zzgtVar = (zzgt) collection; int i = zzgtVar.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.zzyr; if (i3 > jArr.length) { this.zzyr = Arrays.copyOf(jArr, i3); } System.arraycopy(zzgtVar.zzyr, 0, this.zzyr, this.size, zzgtVar.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(Long.valueOf(this.zzyr[i]))) { long[] jArr = this.zzyr; System.arraycopy(jArr, i + 1, jArr, 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) { long longValue = ((Long) obj).longValue(); zzcj(); zzaf(i); long[] jArr = this.zzyr; long j = jArr[i]; jArr[i] = longValue; return Long.valueOf(j); } @Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zzcj(); zzaf(i); long[] jArr = this.zzyr; long j = jArr[i]; int i2 = this.size; if (i < i2 - 1) { System.arraycopy(jArr, i + 1, jArr, i, i2 - i); } this.size--; this.modCount++; return Long.valueOf(j); } @Override // com.google.android.gms.internal.vision.zzef, 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.vision.zzge public final /* synthetic */ zzge zzah(int i) { if (i < this.size) { throw new IllegalArgumentException(); } return new zzgt(Arrays.copyOf(this.zzyr, i), this.size); } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { return Long.valueOf(getLong(i)); } static { zzgt zzgtVar = new zzgt(); zzyq = zzgtVar; zzgtVar.zzci(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.size; } }