package ඓ.ῲ.K.ᓣ;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

/* renamed from: ඓ.ῲ.K.ᓣ.ⁱ  reason: contains not printable characters */
/* compiled from: LruCache */
public class C0841<T, Y> {

    /* renamed from: ʬ  reason: contains not printable characters */
    public long f4061;

    /* renamed from: ῲ  reason: contains not printable characters */
    public long f4062;

    /* renamed from: K  reason: contains not printable characters */
    public final Map<T, Y> f4063 = new LinkedHashMap(100, 0.75f, true);

    public C0841(long j) {
        this.f4062 = j;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public synchronized Y m2436(T t) {
        Y remove;
        remove = this.f4063.remove(t);
        if (remove != null) {
            this.f4061 -= (long) m2437(remove);
        }
        return remove;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public int m2437(Y y) {
        return 1;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public synchronized long m2438() {
        return this.f4062;
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized Y m2440(T t) {
        return this.f4063.get(t);
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m2443(T t, Y y) {
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public synchronized Y m2439(T t, Y y) {
        long r0 = (long) m2437(y);
        if (r0 >= this.f4062) {
            m2443(t, y);
            return null;
        }
        if (y != null) {
            this.f4061 += r0;
        }
        Y put = this.f4063.put(t, y);
        if (put != null) {
            this.f4061 -= (long) m2437(put);
            if (!put.equals(y)) {
                m2443(t, put);
            }
        }
        m2442(this.f4062);
        return put;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m2441() {
        m2442(0);
    }

    /* renamed from: K  reason: contains not printable characters */
    public synchronized void m2442(long j) {
        while (this.f4061 > j) {
            Iterator<Map.Entry<T, Y>> it2 = this.f4063.entrySet().iterator();
            Map.Entry<T, Y> next = it2.next();
            Y value = next.getValue();
            this.f4061 -= (long) m2437(value);
            T key = next.getKey();
            it2.remove();
            m2443(key, value);
        }
    }
}
