package defpackage;

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

/* JADX INFO: renamed from: ᵾᵚᵰ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC5437 extends AbstractC5199 implements Set, j$.util.Set {

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public static final /* synthetic */ int f20626 = 0;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public transient AbstractC1707 f20627;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public static int m11068(int i) {
        int iMax = Math.max(i, 2);
        if (iMax < 751619276) {
            int iHighestOneBit = Integer.highestOneBit(iMax - 1);
            do {
                iHighestOneBit += iHighestOneBit;
            } while (((double) iHighestOneBit) * 0.7d < iMax);
            return iHighestOneBit;
        }
        if (iMax < 1073741824) {
            return 1073741824;
        }
        ᵕᵩʽᵲ.ᵮᵣᵗˈ("collection too large");
        return 0;
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public static AbstractC5437 m11069(int i, Object... objArr) {
        if (i == 0) {
            return C0100.f1357;
        }
        if (i == 1) {
            Object obj = objArr[0];
            Objects.requireNonNull(obj);
            return new C4795(obj);
        }
        int iM11068 = m11068(i);
        Object[] objArr2 = new Object[iM11068];
        int i2 = iM11068 - 1;
        int i3 = 0;
        int i4 = 0;
        for (int i5 = 0; i5 < i; i5++) {
            Object obj2 = objArr[i5];
            if (obj2 == null) {
                C4935.m10233(AbstractC2704.m6517(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 C4795(obj4);
        }
        if (m11068(i4) < iM11068 / 2) {
            return m11069(i4, objArr);
        }
        int length = objArr.length;
        if (i4 < (length >> 1) + (length >> 2)) {
            objArr = Arrays.copyOf(objArr, i4);
        }
        return new C0100(i3, i2, i4, objArr, objArr2);
    }

    @Override // java.util.Collection, java.util.Set
    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if ((obj instanceof AbstractC5437) && (this instanceof C0100) && (((AbstractC5437) obj) instanceof C0100) && 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.AbstractC5199
    /* JADX INFO: renamed from: ᵨᵣ */
    public AbstractC1707 mo3381() {
        AbstractC1707 abstractC1707 = this.f20627;
        if (abstractC1707 != null) {
            return abstractC1707;
        }
        AbstractC1707 abstractC1707Mo1173 = mo1173();
        this.f20627 = abstractC1707Mo1173;
        return abstractC1707Mo1173;
    }

    /* JADX INFO: renamed from: ᵻʽᵯ */
    public AbstractC1707 mo1173() {
        Object[] array = toArray(AbstractC5199.f19586);
        C0092 c0092 = AbstractC1707.f6825;
        return AbstractC1707.m4721(array.length, array);
    }
}
