package p037.p057;

import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;

/* JADX INFO: renamed from: މ.ށ.ޅ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1722<K, V> {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final LinkedHashMap<K, V> f5592;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int f5593;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int f5594;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public int f5595;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public int f5596;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public int f5597;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public int f5598;

    public C1722(int i) {
        if (i <= 0) {
            throw new IllegalArgumentException("maxSize <= 0");
        }
        this.f5594 = i;
        this.f5592 = new LinkedHashMap<>(0, 0.75f, true);
    }

    public final synchronized String toString() {
        int i;
        i = this.f5597 + this.f5598;
        return String.format(Locale.US, "LruCache[maxSize=%d,hits=%d,misses=%d,hitRate=%d%%]", Integer.valueOf(this.f5594), Integer.valueOf(this.f5597), Integer.valueOf(this.f5598), Integer.valueOf(i != 0 ? (this.f5597 * 100) / i : 0));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final synchronized int m3370() {
        return this.f5594;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final V m3371(K k) {
        if (k == null) {
            throw new NullPointerException("key == null");
        }
        synchronized (this) {
            V v = this.f5592.get(k);
            if (v != null) {
                this.f5597++;
                return v;
            }
            this.f5598++;
            return null;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final V m3372(K k, V v) {
        V vPut;
        if (k == null || v == null) {
            throw new NullPointerException("key == null || value == null");
        }
        synchronized (this) {
            this.f5595++;
            this.f5593++;
            vPut = this.f5592.put(k, v);
            if (vPut != null) {
                this.f5593--;
            }
        }
        m3373(this.f5594);
        return vPut;
    }

    /* JADX WARN: Code restructure failed: missing block: B:20:0x0068, code lost:
    
        throw new java.lang.IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
     */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void m3373(int i) {
        while (true) {
            synchronized (this) {
                if (this.f5593 >= 0 && (!this.f5592.isEmpty() || this.f5593 == 0)) {
                    if (this.f5593 <= i || this.f5592.isEmpty()) {
                        break;
                    }
                    Map.Entry<K, V> next = this.f5592.entrySet().iterator().next();
                    K key = next.getKey();
                    next.getValue();
                    this.f5592.remove(key);
                    this.f5593--;
                    this.f5596++;
                } else {
                    break;
                }
            }
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final synchronized int m3374() {
        return this.f5593;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final V m3375(K k) {
        V vRemove;
        if (k == null) {
            throw new NullPointerException("key == null");
        }
        synchronized (this) {
            vRemove = this.f5592.remove(k);
            if (vRemove != null) {
                this.f5593--;
            }
        }
        return vRemove;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final synchronized Map<K, V> m3376() {
        return new LinkedHashMap(this.f5592);
    }
}
