what-the-bank/sources/com/google/android/gms/internal/vision/zzfh.java

202 lines
6.1 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
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 zzfh extends zzef<Double> implements zzge<Double>, zzhr, RandomAccess {
private static final zzfh zztc;
private int size;
private double[] zztd;
zzfh() {
this(new double[10], 0);
}
private zzfh(double[] dArr, int i) {
this.zztd = dArr;
this.size = i;
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
zzcj();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
double[] dArr = this.zztd;
System.arraycopy(dArr, i2, dArr, 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 zzfh)) {
return super.equals(obj);
}
zzfh zzfhVar = (zzfh) obj;
if (this.size != zzfhVar.size) {
return false;
}
double[] dArr = zzfhVar.zztd;
for (int i = 0; i < this.size; i++) {
if (Double.doubleToLongBits(this.zztd[i]) != Double.doubleToLongBits(dArr[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(Double.doubleToLongBits(this.zztd[i2]));
}
return i;
}
public final void zzc(double d) {
zzc(this.size, d);
}
private final void zzc(int i, double d) {
int i2;
zzcj();
if (i < 0 || i > (i2 = this.size)) {
throw new IndexOutOfBoundsException(zzag(i));
}
double[] dArr = this.zztd;
if (i2 < dArr.length) {
System.arraycopy(dArr, i, dArr, i + 1, i2 - i);
} else {
double[] dArr2 = new double[((i2 * 3) / 2) + 1];
System.arraycopy(dArr, 0, dArr2, 0, i);
System.arraycopy(this.zztd, i, dArr2, i + 1, this.size - i);
this.zztd = dArr2;
}
this.zztd[i] = d;
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<? extends Double> collection) {
zzcj();
zzga.checkNotNull(collection);
if (!(collection instanceof zzfh)) {
return super.addAll(collection);
}
zzfh zzfhVar = (zzfh) collection;
int i = zzfhVar.size;
if (i == 0) {
return false;
}
int i2 = this.size;
if (Integer.MAX_VALUE - i2 < i) {
throw new OutOfMemoryError();
}
int i3 = i2 + i;
double[] dArr = this.zztd;
if (i3 > dArr.length) {
this.zztd = Arrays.copyOf(dArr, i3);
}
System.arraycopy(zzfhVar.zztd, 0, this.zztd, this.size, zzfhVar.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(Double.valueOf(this.zztd[i]))) {
double[] dArr = this.zztd;
System.arraycopy(dArr, i + 1, dArr, 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) {
double doubleValue = ((Double) obj).doubleValue();
zzcj();
zzaf(i);
double[] dArr = this.zztd;
double d = dArr[i];
dArr[i] = doubleValue;
return Double.valueOf(d);
}
@Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
zzcj();
zzaf(i);
double[] dArr = this.zztd;
double d = dArr[i];
int i2 = this.size;
if (i < i2 - 1) {
System.arraycopy(dArr, i + 1, dArr, i, i2 - i);
}
this.size--;
this.modCount++;
return Double.valueOf(d);
}
@Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
zzc(i, ((Double) obj).doubleValue());
}
@Override // com.google.android.gms.internal.vision.zzge
public final /* synthetic */ zzge<Double> zzah(int i) {
if (i < this.size) {
throw new IllegalArgumentException();
}
return new zzfh(Arrays.copyOf(this.zztd, i), this.size);
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ Object get(int i) {
zzaf(i);
return Double.valueOf(this.zztd[i]);
}
static {
zzfh zzfhVar = new zzfh();
zztc = zzfhVar;
zzfhVar.zzci();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.size;
}
}