package com.google.android.gms.internal.p002firebaseauthapi;

import com.google.android.recaptcha.internal.a;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.RandomAccess;

/* JADX INFO: loaded from: classes3.dex */
final class zzake extends zzaiq<Float> implements zzakn<Float>, RandomAccess {
    private static final float[] zza;
    private float[] zzb;
    private int zzc;

    static {
        float[] fArr = new float[0];
        zza = fArr;
        new zzake(fArr, 0, false);
    }

    public zzake() {
        this(zza, 0, true);
    }

    private static int zzd(int i6) {
        return Math.max(((i6 * 3) / 2) + 1, 10);
    }

    private final String zze(int i6) {
        return a.i(i6, this.zzc, "Index:", ", Size:");
    }

    private final void zzf(int i6) {
        if (i6 < 0 || i6 >= this.zzc) {
            throw new IndexOutOfBoundsException(zze(i6));
        }
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaiq, java.util.AbstractList, java.util.List
    public final /* synthetic */ void add(int i6, Object obj) {
        int i7;
        float fFloatValue = ((Float) obj).floatValue();
        zza();
        if (i6 < 0 || i6 > (i7 = this.zzc)) {
            throw new IndexOutOfBoundsException(zze(i6));
        }
        float[] fArr = this.zzb;
        if (i7 < fArr.length) {
            System.arraycopy(fArr, i6, fArr, i6 + 1, i7 - i6);
        } else {
            float[] fArr2 = new float[zzd(fArr.length)];
            System.arraycopy(this.zzb, 0, fArr2, 0, i6);
            System.arraycopy(this.zzb, i6, fArr2, i6 + 1, this.zzc - i6);
            this.zzb = fArr2;
        }
        this.zzb[i6] = fFloatValue;
        this.zzc++;
        ((AbstractList) this).modCount++;
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaiq, java.util.AbstractCollection, java.util.Collection, java.util.List
    public final boolean addAll(Collection<? extends Float> collection) {
        zza();
        zzaki.zza(collection);
        if (!(collection instanceof zzake)) {
            return super.addAll(collection);
        }
        zzake zzakeVar = (zzake) collection;
        int i6 = zzakeVar.zzc;
        if (i6 == 0) {
            return false;
        }
        int i7 = this.zzc;
        if (Integer.MAX_VALUE - i7 < i6) {
            throw new OutOfMemoryError();
        }
        int i8 = i7 + i6;
        float[] fArr = this.zzb;
        if (i8 > fArr.length) {
            this.zzb = Arrays.copyOf(fArr, i8);
        }
        System.arraycopy(zzakeVar.zzb, 0, this.zzb, this.zzc, zzakeVar.zzc);
        this.zzc = i8;
        ((AbstractList) 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.p002firebaseauthapi.zzaiq, java.util.AbstractList, java.util.Collection, java.util.List
    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof zzake)) {
            return super.equals(obj);
        }
        zzake zzakeVar = (zzake) obj;
        if (this.zzc != zzakeVar.zzc) {
            return false;
        }
        float[] fArr = zzakeVar.zzb;
        for (int i6 = 0; i6 < this.zzc; i6++) {
            if (Float.floatToIntBits(this.zzb[i6]) != Float.floatToIntBits(fArr[i6])) {
                return false;
            }
        }
        return true;
    }

    @Override // java.util.AbstractList, java.util.List
    public final /* synthetic */ Object get(int i6) {
        return Float.valueOf(zzb(i6));
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaiq, java.util.AbstractList, java.util.Collection, java.util.List
    public final int hashCode() {
        int iFloatToIntBits = 1;
        for (int i6 = 0; i6 < this.zzc; i6++) {
            iFloatToIntBits = (iFloatToIntBits * 31) + Float.floatToIntBits(this.zzb[i6]);
        }
        return iFloatToIntBits;
    }

    @Override // java.util.AbstractList, java.util.List
    public final int indexOf(Object obj) {
        if (!(obj instanceof Float)) {
            return -1;
        }
        float fFloatValue = ((Float) obj).floatValue();
        int size = size();
        for (int i6 = 0; i6 < size; i6++) {
            if (this.zzb[i6] == fFloatValue) {
                return i6;
            }
        }
        return -1;
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaiq, java.util.AbstractList, java.util.List
    public final /* synthetic */ Object remove(int i6) {
        zza();
        zzf(i6);
        float[] fArr = this.zzb;
        float f6 = fArr[i6];
        if (i6 < this.zzc - 1) {
            System.arraycopy(fArr, i6 + 1, fArr, i6, (r2 - i6) - 1);
        }
        this.zzc--;
        ((AbstractList) this).modCount++;
        return Float.valueOf(f6);
    }

    @Override // java.util.AbstractList
    public final void removeRange(int i6, int i7) {
        zza();
        if (i7 < i6) {
            throw new IndexOutOfBoundsException("toIndex < fromIndex");
        }
        float[] fArr = this.zzb;
        System.arraycopy(fArr, i7, fArr, i6, this.zzc - i7);
        this.zzc -= i7 - i6;
        ((AbstractList) this).modCount++;
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaiq, java.util.AbstractList, java.util.List
    public final /* synthetic */ Object set(int i6, Object obj) {
        float fFloatValue = ((Float) obj).floatValue();
        zza();
        zzf(i6);
        float[] fArr = this.zzb;
        float f6 = fArr[i6];
        fArr[i6] = fFloatValue;
        return Float.valueOf(f6);
    }

    @Override // java.util.AbstractCollection, java.util.Collection, java.util.List
    public final int size() {
        return this.zzc;
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzakn
    public final /* synthetic */ zzakn<Float> zza(int i6) {
        if (i6 >= this.zzc) {
            return new zzake(i6 == 0 ? zza : Arrays.copyOf(this.zzb, i6), this.zzc, true);
        }
        throw new IllegalArgumentException();
    }

    public final float zzb(int i6) {
        zzf(i6);
        return this.zzb[i6];
    }

    public final void zzc(int i6) {
        float[] fArr = this.zzb;
        if (i6 <= fArr.length) {
            return;
        }
        if (fArr.length == 0) {
            this.zzb = new float[Math.max(i6, 10)];
            return;
        }
        int length = fArr.length;
        while (length < i6) {
            length = zzd(length);
        }
        this.zzb = Arrays.copyOf(this.zzb, length);
    }

    private zzake(float[] fArr, int i6, boolean z6) {
        super(z6);
        this.zzb = fArr;
        this.zzc = i6;
    }

    public final void zza(float f6) {
        zza();
        int i6 = this.zzc;
        float[] fArr = this.zzb;
        if (i6 == fArr.length) {
            float[] fArr2 = new float[zzd(fArr.length)];
            System.arraycopy(this.zzb, 0, fArr2, 0, this.zzc);
            this.zzb = fArr2;
        }
        float[] fArr3 = this.zzb;
        int i7 = this.zzc;
        this.zzc = i7 + 1;
        fArr3[i7] = f6;
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaiq, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
    public final /* synthetic */ boolean add(Object obj) {
        zza(((Float) obj).floatValue());
        return true;
    }
}
