package defpackage;

import j$.util.Objects;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Set;

/* renamed from: ˋʾˀᵯ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC1447 extends AbstractC4518 implements Set, j$.util.Set {

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public static final /* synthetic */ int f5859 = 0;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public transient AbstractC5058 f5860;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static AbstractC1447 m4352(int i, Object... objArr) {
        if (i == 0) {
            return C2799.f10801;
        }
        if (i == 1) {
            Object obj = objArr[0];
            Objects.requireNonNull(obj);
            return new C2438(obj);
        }
        int iM4353 = m4353(i);
        Object[] objArr2 = new Object[iM4353];
        int i2 = iM4353 - 1;
        int i3 = 0;
        int i4 = 0;
        for (int i5 = 0; i5 < i; i5++) {
            Object obj2 = objArr[i5];
            if (obj2 == null) {
                C1260.m3813(AbstractC2990.m7313(i5, "at index "));
                return null;
            }
            int iHashCode = obj2.hashCode();
            int i6 = ᵛᵾˏ.ˊʽˎ(iHashCode);
            while (true) {
                int i7 = i6 & i2;
                Object obj3 = objArr2[i7];
                if (obj3 == null) {
                    objArr[i4] = obj2;
                    objArr2[i7] = obj2;
                    i3 += iHashCode;
                    i4++;
                    break;
                }
                if (!obj3.equals(obj2)) {
                    i6++;
                }
            }
        }
        Arrays.fill(objArr, i4, i, (Object) null);
        if (i4 == 1) {
            Object obj4 = objArr[0];
            Objects.requireNonNull(obj4);
            return new C2438(obj4);
        }
        if (m4353(i4) < iM4353 / 2) {
            return m4352(i4, objArr);
        }
        int length = objArr.length;
        if (i4 < (length >> 1) + (length >> 2)) {
            objArr = Arrays.copyOf(objArr, i4);
        }
        return new C2799(i3, i2, i4, objArr, objArr2);
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public static int m4353(int i) {
        int iMax = Math.max(i, 2);
        if (iMax < 751619276) {
            int iHighestOneBit = Integer.highestOneBit(iMax - 1);
            do {
                iHighestOneBit += iHighestOneBit;
            } while (iHighestOneBit * 0.7d < iMax);
            return iHighestOneBit;
        }
        if (iMax < 1073741824) {
            return 1073741824;
        }
        ᵹˉᵞ.ˌᵜᵹᵩ("collection too large");
        return 0;
    }

    @Override // java.util.Collection, java.util.Set
    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if ((obj instanceof AbstractC1447) && (this instanceof C2799) && (((AbstractC1447) obj) instanceof C2799) && hashCode() != obj.hashCode()) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (obj instanceof Set) {
            Set set = (Set) obj;
            try {
                if (size() == set.size()) {
                    return containsAll(set);
                }
            } catch (ClassCastException | NullPointerException unused) {
            }
        }
        return false;
    }

    @Override // java.util.Collection, java.util.Set
    public int hashCode() {
        Iterator it = iterator();
        int iHashCode = 0;
        while (it.hasNext()) {
            Object next = it.next();
            iHashCode += next != null ? next.hashCode() : 0;
        }
        return iHashCode;
    }

    @Override // defpackage.AbstractC4518
    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public AbstractC5058 mo4354() {
        AbstractC5058 abstractC5058 = this.f5860;
        if (abstractC5058 != null) {
            return abstractC5058;
        }
        AbstractC5058 abstractC5058Mo2587 = mo2587();
        this.f5860 = abstractC5058Mo2587;
        return abstractC5058Mo2587;
    }

    /* renamed from: ᵝᵵᵺ */
    public AbstractC5058 mo2587() {
        Object[] array = toArray(AbstractC4518.f16829);
        C4741 c4741 = AbstractC5058.f18890;
        return AbstractC5058.m10523(array.length, array);
    }
}
