package ῲ.㴹;

/* renamed from: ῲ.㴹.ᨨ  reason: contains not printable characters */
/* compiled from: SparseArrayCompat */
public class C2276<E> implements Cloneable {

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

    /* renamed from: ʬ  reason: contains not printable characters */
    public int[] f7871;

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

    /* renamed from: ῲ  reason: contains not printable characters */
    public boolean f7873;

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

    public C2276() {
        this(10);
    }

    public String toString() {
        if (m5923() <= 0) {
            return "{}";
        }
        StringBuilder sb = new StringBuilder(this.f7872 * 28);
        sb.append('{');
        for (int i = 0; i < this.f7872; i++) {
            if (i > 0) {
                sb.append(", ");
            }
            sb.append(m5924(i));
            sb.append('=');
            E r2 = m5929(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 m5921(int i) {
        Object[] objArr;
        Object obj;
        int r4 = C2287.m5968(this.f7871, this.f7872, i);
        if (r4 >= 0 && (objArr = this.f7874)[r4] != (obj = f7870)) {
            objArr[r4] = obj;
            this.f7873 = true;
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public E m5925(int i, E e) {
        int r4 = C2287.m5968(this.f7871, this.f7872, i);
        if (r4 >= 0) {
            Object[] objArr = this.f7874;
            if (objArr[r4] != f7870) {
                return (E) objArr[r4];
            }
        }
        return e;
    }

    /* renamed from: K  reason: contains not printable characters */
    public E m5926(int i) {
        return m5925(i, null);
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public E m5929(int i) {
        if (this.f7873) {
            m5927();
        }
        return (E) this.f7874[i];
    }

    public C2276(int i) {
        this.f7873 = false;
        if (i == 0) {
            this.f7871 = C2287.f7902;
            this.f7874 = C2287.f7900;
            return;
        }
        int r2 = C2287.m5966(i);
        this.f7871 = new int[r2];
        this.f7874 = new Object[r2];
    }

    @Override // java.lang.Object
    public C2276<E> clone() {
        try {
            C2276<E> r0 = (C2276) super.clone();
            r0.f7871 = (int[]) this.f7871.clone();
            r0.f7874 = (Object[]) this.f7874.clone();
            return r0;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError(e);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m5927() {
        int i = this.f7872;
        int[] iArr = this.f7871;
        Object[] objArr = this.f7874;
        int i2 = 0;
        for (int i3 = 0; i3 < i; i3++) {
            Object obj = objArr[i3];
            if (obj != f7870) {
                if (i3 != i2) {
                    iArr[i2] = iArr[i3];
                    objArr[i2] = obj;
                    objArr[i3] = null;
                }
                i2++;
            }
        }
        this.f7873 = false;
        this.f7872 = i2;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public int m5923() {
        if (this.f7873) {
            m5927();
        }
        return this.f7872;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public void m5922(int i, E e) {
        int r0 = C2287.m5968(this.f7871, this.f7872, i);
        if (r0 >= 0) {
            this.f7874[r0] = e;
            return;
        }
        int i2 = ~r0;
        if (i2 < this.f7872) {
            Object[] objArr = this.f7874;
            if (objArr[i2] == f7870) {
                this.f7871[i2] = i;
                objArr[i2] = e;
                return;
            }
        }
        if (this.f7873 && this.f7872 >= this.f7871.length) {
            m5927();
            i2 = ~C2287.m5968(this.f7871, this.f7872, i);
        }
        int i3 = this.f7872;
        if (i3 >= this.f7871.length) {
            int r1 = C2287.m5966(i3 + 1);
            int[] iArr = new int[r1];
            Object[] objArr2 = new Object[r1];
            int[] iArr2 = this.f7871;
            System.arraycopy(iArr2, 0, iArr, 0, iArr2.length);
            Object[] objArr3 = this.f7874;
            System.arraycopy(objArr3, 0, objArr2, 0, objArr3.length);
            this.f7871 = iArr;
            this.f7874 = objArr2;
        }
        int i4 = this.f7872;
        if (i4 - i2 != 0) {
            int[] iArr3 = this.f7871;
            int i5 = i2 + 1;
            System.arraycopy(iArr3, i2, iArr3, i5, i4 - i2);
            Object[] objArr4 = this.f7874;
            System.arraycopy(objArr4, i2, objArr4, i5, this.f7872 - i2);
        }
        this.f7871[i2] = i;
        this.f7874[i2] = e;
        this.f7872++;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public int m5924(int i) {
        if (this.f7873) {
            m5927();
        }
        return this.f7871[i];
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5928(int i, E e) {
        int i2 = this.f7872;
        if (i2 == 0 || i > this.f7871[i2 - 1]) {
            if (this.f7873 && this.f7872 >= this.f7871.length) {
                m5927();
            }
            int i3 = this.f7872;
            if (i3 >= this.f7871.length) {
                int r1 = C2287.m5966(i3 + 1);
                int[] iArr = new int[r1];
                Object[] objArr = new Object[r1];
                int[] iArr2 = this.f7871;
                System.arraycopy(iArr2, 0, iArr, 0, iArr2.length);
                Object[] objArr2 = this.f7874;
                System.arraycopy(objArr2, 0, objArr, 0, objArr2.length);
                this.f7871 = iArr;
                this.f7874 = objArr;
            }
            this.f7871[i3] = i;
            this.f7874[i3] = e;
            this.f7872 = i3 + 1;
            return;
        }
        m5922(i, e);
    }
}
