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 zzfv extends zzef implements zzge, zzhr, RandomAccess { private static final zzfv zzwf; private int size; private float[] zzwg; zzfv() { this(new float[10], 0); } private zzfv(float[] fArr, int i) { this.zzwg = fArr; this.size = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zzcj(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } float[] fArr = this.zzwg; System.arraycopy(fArr, i2, fArr, 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 zzfv)) { return super.equals(obj); } zzfv zzfvVar = (zzfv) obj; if (this.size != zzfvVar.size) { return false; } float[] fArr = zzfvVar.zzwg; for (int i = 0; i < this.size; i++) { if (Float.floatToIntBits(this.zzwg[i]) != Float.floatToIntBits(fArr[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) + Float.floatToIntBits(this.zzwg[i2]); } return i; } public final void zzh(float f) { zzc(this.size, f); } private final void zzc(int i, float f) { int i2; zzcj(); if (i < 0 || i > (i2 = this.size)) { throw new IndexOutOfBoundsException(zzag(i)); } float[] fArr = this.zzwg; if (i2 < fArr.length) { System.arraycopy(fArr, i, fArr, i + 1, i2 - i); } else { float[] fArr2 = new float[((i2 * 3) / 2) + 1]; System.arraycopy(fArr, 0, fArr2, 0, i); System.arraycopy(this.zzwg, i, fArr2, i + 1, this.size - i); this.zzwg = fArr2; } this.zzwg[i] = f; 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 zzfv)) { return super.addAll(collection); } zzfv zzfvVar = (zzfv) collection; int i = zzfvVar.size; if (i == 0) { return false; } int i2 = this.size; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; float[] fArr = this.zzwg; if (i3 > fArr.length) { this.zzwg = Arrays.copyOf(fArr, i3); } System.arraycopy(zzfvVar.zzwg, 0, this.zzwg, this.size, zzfvVar.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(Float.valueOf(this.zzwg[i]))) { float[] fArr = this.zzwg; System.arraycopy(fArr, i + 1, fArr, 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) { float floatValue = ((Float) obj).floatValue(); zzcj(); zzaf(i); float[] fArr = this.zzwg; float f = fArr[i]; fArr[i] = floatValue; return Float.valueOf(f); } @Override // com.google.android.gms.internal.vision.zzef, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zzcj(); zzaf(i); float[] fArr = this.zzwg; float f = fArr[i]; int i2 = this.size; if (i < i2 - 1) { System.arraycopy(fArr, i + 1, fArr, i, i2 - i); } this.size--; this.modCount++; return Float.valueOf(f); } @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, ((Float) obj).floatValue()); } @Override // com.google.android.gms.internal.vision.zzge public final /* synthetic */ zzge zzah(int i) { if (i < this.size) { throw new IllegalArgumentException(); } return new zzfv(Arrays.copyOf(this.zzwg, i), this.size); } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { zzaf(i); return Float.valueOf(this.zzwg[i]); } static { zzfv zzfvVar = new zzfv(); zzwf = zzfvVar; zzfvVar.zzci(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.size; } }