discord-jadx/app/src/main/java/b/f/j/c/l.java

69 lines
1.6 KiB
Java
Raw Normal View History

2021-12-17 21:59:34 +00:00
package b.f.j.c;
2021-07-24 02:37:17 +00:00
2021-12-17 21:59:34 +00:00
import b.f.d.d.j;
2022-03-07 09:34:54 +00:00
import com.facebook.cache.common.CacheKey;
2021-07-24 02:37:17 +00:00
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
2022-03-07 09:34:54 +00:00
/* compiled from: CountingLruMap.java */
2022-04-04 09:20:14 +00:00
/* loaded from: classes2.dex */
2021-07-24 02:37:17 +00:00
public class l<K, V> {
public final b0<V> a;
2021-12-17 21:59:34 +00:00
/* renamed from: b reason: collision with root package name */
2022-03-28 08:10:50 +00:00
public final LinkedHashMap<K, V> f556b = new LinkedHashMap<>();
2021-12-17 21:59:34 +00:00
public int c = 0;
2021-07-24 02:37:17 +00:00
public l(b0<V> b0Var) {
this.a = b0Var;
}
public synchronized int a() {
2022-03-28 08:10:50 +00:00
return this.f556b.size();
2021-07-24 02:37:17 +00:00
}
public synchronized int b() {
2021-12-17 21:59:34 +00:00
return this.c;
2021-07-24 02:37:17 +00:00
}
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;
2022-03-28 08:10:50 +00:00
remove = this.f556b.remove(k);
2021-12-17 21:59:34 +00:00
this.c -= c(remove);
2022-03-28 08:10:50 +00:00
this.f556b.put(k, v);
2021-12-17 21:59:34 +00:00
this.c += c(v);
2021-07-24 02:37:17 +00:00
return remove;
}
public synchronized V e(K k) {
V remove;
2022-03-28 08:10:50 +00:00
remove = this.f556b.remove(k);
2021-12-17 21:59:34 +00:00
this.c -= c(remove);
2021-07-24 02:37:17 +00:00
return remove;
}
public synchronized ArrayList<V> f(j<K> jVar) {
ArrayList<V> arrayList;
arrayList = new ArrayList<>();
2022-03-28 08:10:50 +00:00
Iterator<Map.Entry<K, V>> it = this.f556b.entrySet().iterator();
2021-07-24 02:37:17 +00:00
while (it.hasNext()) {
Map.Entry<K, V> next = it.next();
if (jVar != null) {
2022-03-07 09:34:54 +00:00
CacheKey cacheKey = (CacheKey) next.getKey();
2021-07-24 02:37:17 +00:00
}
arrayList.add(next.getValue());
2021-12-17 21:59:34 +00:00
this.c -= c(next.getValue());
2021-07-24 02:37:17 +00:00
it.remove();
}
return arrayList;
}
}