package androidx.collection;

/* loaded from: classes.dex */
public abstract class j {

    /* renamed from: a, reason: collision with root package name */
    public int[] f1329a;

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

    public /* synthetic */ j(int i10, kotlin.jvm.internal.k kVar) {
        this(i10);
    }

    public static /* synthetic */ String d(j jVar, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i10, CharSequence charSequence4, int i11, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: joinToString");
        }
        if ((i11 & 1) != 0) {
            charSequence = ", ";
        }
        CharSequence charSequence5 = (i11 & 2) != 0 ? "" : charSequence2;
        CharSequence charSequence6 = (i11 & 4) == 0 ? charSequence3 : "";
        if ((i11 & 8) != 0) {
            i10 = -1;
        }
        int i12 = i10;
        if ((i11 & 16) != 0) {
            charSequence4 = "...";
        }
        return jVar.c(charSequence, charSequence5, charSequence6, i12, charSequence4);
    }

    public final int a(int i10) {
        boolean z10 = false;
        if (i10 >= 0 && i10 < this.f1330b) {
            z10 = true;
        }
        if (z10) {
            return this.f1329a[i10];
        }
        throw new IndexOutOfBoundsException("Index " + i10 + " must be in 0.." + (this.f1330b - 1));
    }

    public final int b() {
        return this.f1330b;
    }

    public final String c(CharSequence separator, CharSequence prefix, CharSequence postfix, int i10, CharSequence truncated) {
        kotlin.jvm.internal.t.g(separator, "separator");
        kotlin.jvm.internal.t.g(prefix, "prefix");
        kotlin.jvm.internal.t.g(postfix, "postfix");
        kotlin.jvm.internal.t.g(truncated, "truncated");
        StringBuilder sb2 = new StringBuilder();
        sb2.append(prefix);
        int[] iArr = this.f1329a;
        int i11 = this.f1330b;
        int i12 = 0;
        while (true) {
            if (i12 >= i11) {
                sb2.append(postfix);
                break;
            }
            int i13 = iArr[i12];
            if (i12 == i10) {
                sb2.append(truncated);
                break;
            }
            if (i12 != 0) {
                sb2.append(separator);
            }
            sb2.append(i13);
            i12++;
        }
        String sb3 = sb2.toString();
        kotlin.jvm.internal.t.f(sb3, "StringBuilder().apply(builderAction).toString()");
        return sb3;
    }

    public boolean equals(Object obj) {
        jn.i q10;
        if (obj instanceof j) {
            j jVar = (j) obj;
            int i10 = jVar.f1330b;
            int i11 = this.f1330b;
            if (i10 == i11) {
                int[] iArr = this.f1329a;
                int[] iArr2 = jVar.f1329a;
                q10 = jn.o.q(0, i11);
                int g10 = q10.g();
                int m10 = q10.m();
                if (g10 > m10) {
                    return true;
                }
                while (iArr[g10] == iArr2[g10]) {
                    if (g10 == m10) {
                        return true;
                    }
                    g10++;
                }
                return false;
            }
        }
        return false;
    }

    public int hashCode() {
        int[] iArr = this.f1329a;
        int i10 = this.f1330b;
        int i11 = 0;
        for (int i12 = 0; i12 < i10; i12++) {
            i11 += Integer.hashCode(iArr[i12]) * 31;
        }
        return i11;
    }

    public String toString() {
        return d(this, null, "[", "]", 0, null, 25, null);
    }

    private j(int i10) {
        int[] iArr;
        if (i10 == 0) {
            iArr = o.a();
        } else {
            iArr = new int[i10];
        }
        this.f1329a = iArr;
    }
}
