discord-jadx/app/src/main/java/b/g/a/c/i0/h.java

51 lines
1.4 KiB
Java
Raw Normal View History

2021-12-21 23:37:30 +00:00
package b.g.a.c.i0;
2021-06-27 20:44:35 +00:00
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.concurrent.ConcurrentHashMap;
2022-03-02 20:59:20 +00:00
/* compiled from: LRUMap.java */
2022-03-08 21:11:21 +00:00
/* loaded from: classes3.dex */
2021-06-27 20:44:35 +00:00
public class h<K, V> implements j<K, V>, Serializable {
private static final long serialVersionUID = 1;
2021-12-17 22:03:14 +00:00
public final transient int j;
public final transient ConcurrentHashMap<K, V> k;
public transient int l;
2021-06-27 20:44:35 +00:00
public h(int i, int i2) {
2021-12-17 22:03:14 +00:00
this.k = new ConcurrentHashMap<>(i, 0.8f, 4);
this.j = i2;
2021-06-27 20:44:35 +00:00
}
private void readObject(ObjectInputStream objectInputStream) throws IOException {
2021-12-17 22:03:14 +00:00
this.l = objectInputStream.readInt();
2021-06-27 20:44:35 +00:00
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
2021-12-17 22:03:14 +00:00
objectOutputStream.writeInt(this.l);
2021-06-27 20:44:35 +00:00
}
2021-12-21 23:37:30 +00:00
@Override // b.g.a.c.i0.j
2021-06-27 20:44:35 +00:00
public V get(Object obj) {
2021-12-17 22:03:14 +00:00
return this.k.get(obj);
2021-06-27 20:44:35 +00:00
}
2021-12-21 23:37:30 +00:00
@Override // b.g.a.c.i0.j
2021-06-27 20:44:35 +00:00
public V putIfAbsent(K k, V v) {
2021-12-17 22:03:14 +00:00
if (this.k.size() >= this.j) {
2021-06-27 20:44:35 +00:00
synchronized (this) {
2021-12-17 22:03:14 +00:00
if (this.k.size() >= this.j) {
this.k.clear();
2021-06-27 20:44:35 +00:00
}
}
}
2021-12-17 22:03:14 +00:00
return this.k.putIfAbsent(k, v);
2021-06-27 20:44:35 +00:00
}
public Object readResolve() {
2021-12-17 22:03:14 +00:00
int i = this.l;
2021-06-27 20:44:35 +00:00
return new h(i, i);
}
}