what-the-bank/sources/com/google/android/gms/internal/measurement/zzkr.java

231 lines
6.8 KiB
Java

package com.google.android.gms.internal.measurement;
import java.util.Arrays;
import java.util.Collection;
import java.util.RandomAccess;
/* loaded from: classes.dex */
final class zzkr extends zzii<Long> implements RandomAccess, zzkd, zzlj {
private static final zzkr zza;
private long[] zzb;
private int zzc;
static {
zzkr zzkrVar = new zzkr(new long[0], 0);
zza = zzkrVar;
zzkrVar.zzb();
}
zzkr() {
this(new long[10], 0);
}
private final String zzh(int i) {
int i2 = this.zzc;
StringBuilder sb = new StringBuilder(35);
sb.append("Index:");
sb.append(i);
sb.append(", Size:");
sb.append(i2);
return sb.toString();
}
private final void zzi(int i) {
if (i < 0 || i >= this.zzc) {
throw new IndexOutOfBoundsException(zzh(i));
}
}
@Override // com.google.android.gms.internal.measurement.zzii, java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
int i2;
long longValue = ((Long) obj).longValue();
zzbM();
if (i < 0 || i > (i2 = this.zzc)) {
throw new IndexOutOfBoundsException(zzh(i));
}
long[] jArr = this.zzb;
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.zzb, i, jArr2, i + 1, this.zzc - i);
this.zzb = jArr2;
}
this.zzb[i] = longValue;
this.zzc++;
this.modCount++;
}
@Override // com.google.android.gms.internal.measurement.zzii, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean addAll(Collection<? extends Long> collection) {
zzbM();
zzkf.zze(collection);
if (!(collection instanceof zzkr)) {
return super.addAll(collection);
}
zzkr zzkrVar = (zzkr) collection;
int i = zzkrVar.zzc;
if (i == 0) {
return false;
}
int i2 = this.zzc;
if (Integer.MAX_VALUE - i2 < i) {
throw new OutOfMemoryError();
}
int i3 = i2 + i;
long[] jArr = this.zzb;
if (i3 > jArr.length) {
this.zzb = Arrays.copyOf(jArr, i3);
}
System.arraycopy(zzkrVar.zzb, 0, this.zzb, this.zzc, zzkrVar.zzc);
this.zzc = i3;
this.modCount++;
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean contains(Object obj) {
return indexOf(obj) != -1;
}
@Override // com.google.android.gms.internal.measurement.zzii, java.util.AbstractList, java.util.Collection, java.util.List
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof zzkr)) {
return super.equals(obj);
}
zzkr zzkrVar = (zzkr) obj;
if (this.zzc != zzkrVar.zzc) {
return false;
}
long[] jArr = zzkrVar.zzb;
for (int i = 0; i < this.zzc; i++) {
if (this.zzb[i] != jArr[i]) {
return false;
}
}
return true;
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ Object get(int i) {
zzi(i);
return Long.valueOf(this.zzb[i]);
}
@Override // com.google.android.gms.internal.measurement.zzii, java.util.AbstractList, java.util.Collection, java.util.List
public final int hashCode() {
int i = 1;
for (int i2 = 0; i2 < this.zzc; i2++) {
i = (i * 31) + zzkf.zzc(this.zzb[i2]);
}
return i;
}
@Override // java.util.AbstractList, java.util.List
public final int indexOf(Object obj) {
if (!(obj instanceof Long)) {
return -1;
}
long longValue = ((Long) obj).longValue();
int i = this.zzc;
for (int i2 = 0; i2 < i; i2++) {
if (this.zzb[i2] == longValue) {
return i2;
}
}
return -1;
}
@Override // com.google.android.gms.internal.measurement.zzii, java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
zzbM();
zzi(i);
long[] jArr = this.zzb;
long j = jArr[i];
if (i < this.zzc - 1) {
System.arraycopy(jArr, i + 1, jArr, i, (r3 - i) - 1);
}
this.zzc--;
this.modCount++;
return Long.valueOf(j);
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
zzbM();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
long[] jArr = this.zzb;
System.arraycopy(jArr, i2, jArr, i, this.zzc - i2);
this.zzc -= i2 - i;
this.modCount++;
}
@Override // com.google.android.gms.internal.measurement.zzii, java.util.AbstractList, java.util.List
public final /* synthetic */ Object set(int i, Object obj) {
long longValue = ((Long) obj).longValue();
zzbM();
zzi(i);
long[] jArr = this.zzb;
long j = jArr[i];
jArr[i] = longValue;
return Long.valueOf(j);
}
@Override // com.google.android.gms.internal.measurement.zzkd
public final long zza(int i) {
zzi(i);
return this.zzb[i];
}
@Override // com.google.android.gms.internal.measurement.zzke
/* renamed from: zze, reason: merged with bridge method [inline-methods] */
public final zzkd zzd(int i) {
if (i < this.zzc) {
throw new IllegalArgumentException();
}
return new zzkr(Arrays.copyOf(this.zzb, i), this.zzc);
}
public final void zzg(long j) {
zzbM();
int i = this.zzc;
long[] jArr = this.zzb;
if (i == jArr.length) {
long[] jArr2 = new long[((i * 3) / 2) + 1];
System.arraycopy(jArr, 0, jArr2, 0, i);
this.zzb = jArr2;
}
long[] jArr3 = this.zzb;
int i2 = this.zzc;
this.zzc = i2 + 1;
jArr3[i2] = j;
}
private zzkr(long[] jArr, int i) {
this.zzb = jArr;
this.zzc = i;
}
@Override // com.google.android.gms.internal.measurement.zzii, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
public final /* synthetic */ boolean add(Object obj) {
zzg(((Long) obj).longValue());
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.zzc;
}
public static zzkr zzf() {
return zza;
}
}