package androidx.collection;

import java.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public final class o {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public float[] f956a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f957b;

    public o(int i10) {
        this.f956a = i10 == 0 ? j.f941a : new float[i10];
    }

    public static String e(o oVar, String str, String str2, int i10) {
        String str3 = (i10 & 1) != 0 ? ", " : null;
        if ((i10 & 2) != 0) {
            str = "";
        }
        if ((i10 & 4) != 0) {
            str2 = "";
        }
        int i11 = 0;
        int i12 = (i10 & 8) != 0 ? -1 : 0;
        String str4 = (i10 & 16) != 0 ? "..." : null;
        oVar.getClass();
        nb.g.i(str3, "separator");
        nb.g.i(str, "prefix");
        nb.g.i(str2, "postfix");
        nb.g.i(str4, "truncated");
        StringBuilder sb = new StringBuilder();
        sb.append((CharSequence) str);
        float[] fArr = oVar.f956a;
        int i13 = oVar.f957b;
        while (true) {
            if (i11 >= i13) {
                sb.append((CharSequence) str2);
                break;
            }
            float f10 = fArr[i11];
            if (i11 == i12) {
                sb.append((CharSequence) str4);
                break;
            }
            if (i11 != 0) {
                sb.append((CharSequence) str3);
            }
            sb.append(f10);
            i11++;
        }
        String string = sb.toString();
        nb.g.h(string, "StringBuilder().apply(builderAction).toString()");
        return string;
    }

    public final void a(float f10) {
        int i10 = this.f957b + 1;
        float[] fArr = this.f956a;
        if (fArr.length < i10) {
            float[] fArrCopyOf = Arrays.copyOf(fArr, Math.max(i10, (fArr.length * 3) / 2));
            nb.g.h(fArrCopyOf, "copyOf(this, newSize)");
            this.f956a = fArrCopyOf;
        }
        float[] fArr2 = this.f956a;
        int i11 = this.f957b;
        fArr2[i11] = f10;
        this.f957b = i11 + 1;
    }

    /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
    public final boolean equals(Object obj) {
        if (obj instanceof o) {
            o oVar = (o) obj;
            int i10 = oVar.f957b;
            int i11 = this.f957b;
            if (i10 == i11) {
                float[] fArr = this.f956a;
                float[] fArr2 = oVar.f956a;
                xd.c cVarM = ua.b.M(0, i11);
                int i12 = cVarM.f34807a;
                int i13 = cVarM.f34808b;
                if (i12 > i13) {
                    return true;
                }
                while (fArr[i12] == fArr2[i12]) {
                    if (i12 == i13) {
                        return true;
                    }
                    i12++;
                }
                return false;
            }
        }
        return false;
    }

    public final float c(int i10) {
        if (i10 >= 0 && i10 < this.f957b) {
            return this.f956a[i10];
        }
        StringBuilder sbQ = defpackage.e.q("Index ", i10, " must be in 0..");
        sbQ.append(this.f957b - 1);
        throw new IndexOutOfBoundsException(sbQ.toString());
    }

    /* JADX INFO: renamed from: d, reason: merged with bridge method [inline-methods] */
    public final int hashCode() {
        float[] fArr = this.f956a;
        int i10 = this.f957b;
        int iHashCode = 0;
        for (int i11 = 0; i11 < i10; i11++) {
            iHashCode += Float.hashCode(fArr[i11]) * 31;
        }
        return iHashCode;
    }

    /* JADX INFO: renamed from: f, reason: merged with bridge method [inline-methods] */
    public final String toString() {
        return e(this, "[", "]", 25);
    }
}
