package p138.p145.p146.p174;

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

/* JADX INFO: renamed from: ދ.ؠ.֏.ޒ.ބ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C3237<T, Y> {

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

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

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

    public C3237(long j) {
        this.f9583 = j;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized long m5321() {
        return this.f9583;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized Y m5322(T t) {
        return this.f9582.get(t);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized void m5323(long j) {
        while (this.f9584 > j) {
            Iterator<Map.Entry<T, Y>> it = this.f9582.entrySet().iterator();
            Map.Entry<T, Y> next = it.next();
            Y value = next.getValue();
            this.f9584 -= (long) mo5126(value);
            T key = next.getKey();
            it.remove();
            mo5125(key, value);
        }
    }

    /* JADX INFO: renamed from: ֏ */
    public void mo5125(T t, Y y) {
    }

    /* JADX INFO: renamed from: ؠ */
    public int mo5126(Y y) {
        return 1;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public synchronized Y m5324(T t, Y y) {
        long jMo5126 = mo5126(y);
        if (jMo5126 >= this.f9583) {
            mo5125(t, y);
            return null;
        }
        if (y != null) {
            this.f9584 += jMo5126;
        }
        Y yPut = this.f9582.put(t, y);
        if (yPut != null) {
            this.f9584 -= (long) mo5126(yPut);
            if (!yPut.equals(y)) {
                mo5125(t, yPut);
            }
        }
        m5323(this.f9583);
        return yPut;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public synchronized Y m5325(T t) {
        Y yRemove;
        yRemove = this.f9582.remove(t);
        if (yRemove != null) {
            this.f9584 -= (long) mo5126(yRemove);
        }
        return yRemove;
    }
}
