package x4;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import m3.AbstractC2478m;
import n2.AbstractC2612c;

/* JADX INFO: renamed from: x4.r, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC3252r extends AbstractC2612c {
    public static int A(List list) {
        kotlin.jvm.internal.o.h(list, "<this>");
        return list.size() - 1;
    }

    public static List B(Object... elements) {
        kotlin.jvm.internal.o.h(elements, "elements");
        return elements.length > 0 ? AbstractC3250p.r(elements) : y.f26065a;
    }

    public static ArrayList C(Object... objArr) {
        return objArr.length == 0 ? new ArrayList() : new ArrayList(new C3248n(objArr, true));
    }

    public static final List D(List list) {
        int size = list.size();
        return size != 0 ? size != 1 ? list : AbstractC2612c.q(list.get(0)) : y.f26065a;
    }

    public static final void E(int i6, int i7) {
        if (i7 < 0) {
            throw new IllegalArgumentException(Z0.o.j(i7, "fromIndex (0) is greater than toIndex (", ")."));
        }
        if (i7 <= i6) {
            return;
        }
        throw new IndexOutOfBoundsException("toIndex (" + i7 + ") is greater than size (" + i6 + ").");
    }

    public static void F() {
        throw new ArithmeticException("Index overflow has happened.");
    }

    public static ArrayList x(Object... objArr) {
        return objArr.length == 0 ? new ArrayList() : new ArrayList(new C3248n(objArr, true));
    }

    public static int y(ArrayList arrayList, Comparable comparable) {
        int size = arrayList.size();
        kotlin.jvm.internal.o.h(arrayList, "<this>");
        E(arrayList.size(), size);
        int i6 = size - 1;
        int i7 = 0;
        while (i7 <= i6) {
            int i8 = (i7 + i6) >>> 1;
            int iD = AbstractC2478m.d((Comparable) arrayList.get(i8), comparable);
            if (iD < 0) {
                i7 = i8 + 1;
            } else {
                if (iD <= 0) {
                    return i8;
                }
                i6 = i8 - 1;
            }
        }
        return -(i7 + 1);
    }

    public static P4.g z(Collection collection) {
        return new P4.g(0, collection.size() - 1, 1);
    }
}
