package ῲ.㴹;

/* renamed from: ῲ.㴹.ඓ  reason: contains not printable characters */
/* compiled from: LongSparseArray */
public class C2275<E> implements Cloneable {

    /* renamed from: 㴹  reason: contains not printable characters */
    public static final Object f7865 = new Object();

    /* renamed from: ʬ  reason: contains not printable characters */
    public long[] f7866;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f7867;

    /* renamed from: ῲ  reason: contains not printable characters */
    public boolean f7868 = false;

    /* renamed from: 㸾  reason: contains not printable characters */
    public Object[] f7869;

    public C2275() {
        int r0 = C2287.m5965(10);
        this.f7866 = new long[r0];
        this.f7869 = new Object[r0];
    }

    public String toString() {
        if (m5913() <= 0) {
            return "{}";
        }
        StringBuilder sb = new StringBuilder(this.f7867 * 28);
        sb.append('{');
        for (int i = 0; i < this.f7867; i++) {
            if (i > 0) {
                sb.append(", ");
            }
            if (this.f7868) {
                m5916();
            }
            sb.append(this.f7866[i]);
            sb.append('=');
            E r2 = m5917(i);
            if (r2 != this) {
                sb.append((Object) r2);
            } else {
                sb.append("(this Map)");
            }
        }
        sb.append('}');
        return sb.toString();
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public void m5914(long j, E e) {
        int r0 = C2287.m5969(this.f7866, this.f7867, j);
        if (r0 >= 0) {
            this.f7869[r0] = e;
            return;
        }
        int i = ~r0;
        if (i < this.f7867) {
            Object[] objArr = this.f7869;
            if (objArr[i] == f7865) {
                this.f7866[i] = j;
                objArr[i] = e;
                return;
            }
        }
        if (this.f7868 && this.f7867 >= this.f7866.length) {
            m5916();
            i = ~C2287.m5969(this.f7866, this.f7867, j);
        }
        int i2 = this.f7867;
        if (i2 >= this.f7866.length) {
            int r1 = C2287.m5965(i2 + 1);
            long[] jArr = new long[r1];
            Object[] objArr2 = new Object[r1];
            long[] jArr2 = this.f7866;
            System.arraycopy(jArr2, 0, jArr, 0, jArr2.length);
            Object[] objArr3 = this.f7869;
            System.arraycopy(objArr3, 0, objArr2, 0, objArr3.length);
            this.f7866 = jArr;
            this.f7869 = objArr2;
        }
        int i3 = this.f7867;
        if (i3 - i != 0) {
            long[] jArr3 = this.f7866;
            int i4 = i + 1;
            System.arraycopy(jArr3, i, jArr3, i4, i3 - i);
            Object[] objArr4 = this.f7869;
            System.arraycopy(objArr4, i, objArr4, i4, this.f7867 - i);
        }
        this.f7866[i] = j;
        this.f7869[i] = e;
        this.f7867++;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public E m5915(long j, E e) {
        int r3 = C2287.m5969(this.f7866, this.f7867, j);
        if (r3 >= 0) {
            Object[] objArr = this.f7869;
            if (objArr[r3] != f7865) {
                return (E) objArr[r3];
            }
        }
        return e;
    }

    /* renamed from: K  reason: contains not printable characters */
    public E m5918(long j) {
        return m5915(j, null);
    }

    @Override // java.lang.Object
    public C2275<E> clone() {
        try {
            C2275<E> r0 = (C2275) super.clone();
            r0.f7866 = (long[]) this.f7866.clone();
            r0.f7869 = (Object[]) this.f7869.clone();
            return r0;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError(e);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public E m5917(int i) {
        if (this.f7868) {
            m5916();
        }
        return (E) this.f7869[i];
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public final void m5916() {
        int i = this.f7867;
        long[] jArr = this.f7866;
        Object[] objArr = this.f7869;
        int i2 = 0;
        for (int i3 = 0; i3 < i; i3++) {
            Object obj = objArr[i3];
            if (obj != f7865) {
                if (i3 != i2) {
                    jArr[i2] = jArr[i3];
                    objArr[i2] = obj;
                    objArr[i3] = null;
                }
                i2++;
            }
        }
        this.f7868 = false;
        this.f7867 = i2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5919() {
        int i = this.f7867;
        Object[] objArr = this.f7869;
        for (int i2 = 0; i2 < i; i2++) {
            objArr[i2] = null;
        }
        this.f7867 = 0;
        this.f7868 = false;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5920(long j, E e) {
        int i = this.f7867;
        if (i == 0 || j > this.f7866[i - 1]) {
            if (this.f7868 && this.f7867 >= this.f7866.length) {
                m5916();
            }
            int i2 = this.f7867;
            if (i2 >= this.f7866.length) {
                int r1 = C2287.m5965(i2 + 1);
                long[] jArr = new long[r1];
                Object[] objArr = new Object[r1];
                long[] jArr2 = this.f7866;
                System.arraycopy(jArr2, 0, jArr, 0, jArr2.length);
                Object[] objArr2 = this.f7869;
                System.arraycopy(objArr2, 0, objArr, 0, objArr2.length);
                this.f7866 = jArr;
                this.f7869 = objArr;
            }
            this.f7866[i2] = j;
            this.f7869[i2] = e;
            this.f7867 = i2 + 1;
            return;
        }
        m5914(j, e);
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public int m5913() {
        if (this.f7868) {
            m5916();
        }
        return this.f7867;
    }
}
