jimu-decompiled/sources/com/google/android/gms/internal/measurement/zzup.java
2025-05-13 19:24:51 +02:00

203 lines
5.8 KiB
Java

package com.google.android.gms.internal.measurement;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.RandomAccess;
/* loaded from: classes.dex */
final class zzup extends zzta<Integer> implements zzuu<Integer>, zzwg, RandomAccess {
private int[] b;
private int c;
static {
new zzup().i();
}
zzup() {
this(new int[10], 0);
}
private final void a(int i, int i2) {
int i3;
a();
if (i < 0 || i > (i3 = this.c)) {
throw new IndexOutOfBoundsException(f(i));
}
int[] iArr = this.b;
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.b, i, iArr2, i + 1, this.c - i);
this.b = iArr2;
}
this.b[i] = i2;
this.c++;
((AbstractList) this).modCount++;
}
private final void e(int i) {
if (i < 0 || i >= this.c) {
throw new IndexOutOfBoundsException(f(i));
}
}
private final String f(int i) {
int i2 = this.c;
StringBuilder sb = new StringBuilder(35);
sb.append("Index:");
sb.append(i);
sb.append(", Size:");
sb.append(i2);
return sb.toString();
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
a(i, ((Integer) obj).intValue());
}
@Override // com.google.android.gms.internal.measurement.zzta, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean addAll(Collection<? extends Integer> collection) {
a();
zzuq.a(collection);
if (!(collection instanceof zzup)) {
return super.addAll(collection);
}
zzup zzupVar = (zzup) collection;
int i = zzupVar.c;
if (i == 0) {
return false;
}
int i2 = this.c;
if (Integer.MAX_VALUE - i2 < i) {
throw new OutOfMemoryError();
}
int i3 = i2 + i;
int[] iArr = this.b;
if (i3 > iArr.length) {
this.b = Arrays.copyOf(iArr, i3);
}
System.arraycopy(zzupVar.b, 0, this.b, this.c, zzupVar.c);
this.c = i3;
((AbstractList) this).modCount++;
return true;
}
public final int c(int i) {
e(i);
return this.b[i];
}
public final void d(int i) {
a(this.c, i);
}
@Override // com.google.android.gms.internal.measurement.zzta, java.util.AbstractList, java.util.Collection, java.util.List
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof zzup)) {
return super.equals(obj);
}
zzup zzupVar = (zzup) obj;
if (this.c != zzupVar.c) {
return false;
}
int[] iArr = zzupVar.b;
for (int i = 0; i < this.c; i++) {
if (this.b[i] != iArr[i]) {
return false;
}
}
return true;
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ Object get(int i) {
return Integer.valueOf(c(i));
}
@Override // com.google.android.gms.internal.measurement.zzta, java.util.AbstractList, java.util.Collection, java.util.List
public final int hashCode() {
int i = 1;
for (int i2 = 0; i2 < this.c; i2++) {
i = (i * 31) + this.b[i2];
}
return i;
}
@Override // com.google.android.gms.internal.measurement.zzta, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean remove(Object obj) {
a();
for (int i = 0; i < this.c; i++) {
if (obj.equals(Integer.valueOf(this.b[i]))) {
int[] iArr = this.b;
System.arraycopy(iArr, i + 1, iArr, i, (this.c - i) - 1);
this.c--;
((AbstractList) this).modCount++;
return true;
}
}
return false;
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
a();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
int[] iArr = this.b;
System.arraycopy(iArr, i2, iArr, i, this.c - i2);
this.c -= i2 - i;
((AbstractList) this).modCount++;
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ Object set(int i, Object obj) {
int intValue = ((Integer) obj).intValue();
a();
e(i);
int[] iArr = this.b;
int i2 = iArr[i];
iArr[i] = intValue;
return Integer.valueOf(i2);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.c;
}
private zzup(int[] iArr, int i) {
this.b = iArr;
this.c = i;
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
a();
e(i);
int[] iArr = this.b;
int i2 = iArr[i];
if (i < this.c - 1) {
System.arraycopy(iArr, i + 1, iArr, i, (r2 - i) - 1);
}
this.c--;
((AbstractList) this).modCount++;
return Integer.valueOf(i2);
}
@Override // com.google.android.gms.internal.measurement.zzuu
public final /* synthetic */ zzuu<Integer> a(int i) {
if (i >= this.c) {
return new zzup(Arrays.copyOf(this.b, i), this.c);
}
throw new IllegalArgumentException();
}
}