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 zzry extends zzpo implements zzrj, zzsv, RandomAccess { private static final zzry zzbck; private int size; private long[] zzbcl; zzry() { this(new long[10], 0); } private zzry(long[] jArr, int i) { this.zzbcl = jArr; this.size = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zzmz(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } long[] jArr = this.zzbcl; System.arraycopy(jArr, i2, jArr, 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 zzry)) { return super.equals(obj); } zzry zzryVar = (zzry) obj; if (this.size != zzryVar.size) { return false; } long[] jArr = zzryVar.zzbcl; for (int i = 0; i < this.size; i++) { if (this.zzbcl[i] != jArr[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) + zzre.zzz(this.zzbcl[i2]); } return i; } public final long getLong(int i) { zzah(i); return this.zzbcl[i]; } public final void zzaa(long j) { zzk(this.size, j); } private final void zzk(int i, long j) { int i2; zzmz(); if (i < 0 || i > (i2 = this.size)) { throw new IndexOutOfBoundsException(zzai(i)); } long[] jArr = this.zzbcl; 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.zzbcl, i, jArr2, i + 1, this.size - i); this.zzbcl = jArr2; } this.zzbcl[i] = j; 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 zzry)) { return super.addAll(collection); } zzry zzryVar = (zzry) collection; int i = zzryVar.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.zzbcl; if (i3 > jArr.length) { this.zzbcl = Arrays.copyOf(jArr, i3); } System.arraycopy(zzryVar.zzbcl, 0, this.zzbcl, this.size, zzryVar.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(Long.valueOf(this.zzbcl[i]))) { long[] jArr = this.zzbcl; System.arraycopy(jArr, i + 1, jArr, 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) { long longValue = ((Long) obj).longValue(); zzmz(); zzah(i); long[] jArr = this.zzbcl; long j = jArr[i]; jArr[i] = longValue; return Long.valueOf(j); } @Override // com.google.android.gms.internal.gtm.zzpo, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zzmz(); zzah(i); long[] jArr = this.zzbcl; 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.gtm.zzpo, 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.gtm.zzrj public final /* synthetic */ zzrj zzaj(int i) { if (i < this.size) { throw new IllegalArgumentException(); } return new zzry(Arrays.copyOf(this.zzbcl, i), this.size); } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { return Long.valueOf(getLong(i)); } static { zzry zzryVar = new zzry(new long[0], 0); zzbck = zzryVar; zzryVar.zzmi(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.size; } }