66 lines
1.5 KiB
Java
66 lines
1.5 KiB
Java
package c.f.j.c;
|
|
|
|
import c.f.d.d.j;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
/* compiled from: CountingLruMap */
|
|
public class l<K, V> {
|
|
public final b0<V> a;
|
|
public final LinkedHashMap<K, V> b = new LinkedHashMap<>();
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public int f423c = 0;
|
|
|
|
public l(b0<V> b0Var) {
|
|
this.a = b0Var;
|
|
}
|
|
|
|
public synchronized int a() {
|
|
return this.b.size();
|
|
}
|
|
|
|
public synchronized int b() {
|
|
return this.f423c;
|
|
}
|
|
|
|
public final int c(V v) {
|
|
if (v == null) {
|
|
return 0;
|
|
}
|
|
return this.a.a(v);
|
|
}
|
|
|
|
public synchronized V d(K k, V v) {
|
|
V remove;
|
|
remove = this.b.remove(k);
|
|
this.f423c -= c(remove);
|
|
this.b.put(k, v);
|
|
this.f423c += c(v);
|
|
return remove;
|
|
}
|
|
|
|
public synchronized V e(K k) {
|
|
V remove;
|
|
remove = this.b.remove(k);
|
|
this.f423c -= c(remove);
|
|
return remove;
|
|
}
|
|
|
|
public synchronized ArrayList<V> f(j<K> jVar) {
|
|
ArrayList<V> arrayList;
|
|
arrayList = new ArrayList<>();
|
|
Iterator<Map.Entry<K, V>> it = this.b.entrySet().iterator();
|
|
while (it.hasNext()) {
|
|
Map.Entry<K, V> next = it.next();
|
|
if (jVar != null) {
|
|
next.getKey();
|
|
}
|
|
arrayList.add(next.getValue());
|
|
this.f423c -= c(next.getValue());
|
|
it.remove();
|
|
}
|
|
return arrayList;
|
|
}
|
|
}
|