mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-16 02:47:17 +01:00
62 lines
2 KiB
Java
62 lines
2 KiB
Java
package com.fasterxml.jackson.databind.util;
|
|
|
|
import com.fasterxml.jackson.databind.util.internal.PrivateMaxEntriesMap;
|
|
import java.io.Serializable;
|
|
import java.util.Map;
|
|
import java.util.function.BiConsumer;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public class LRUMap<K, V> implements LookupCache<K, V>, Serializable {
|
|
private static final long serialVersionUID = 2;
|
|
protected final int _initialEntries;
|
|
protected final transient PrivateMaxEntriesMap<K, V> _map;
|
|
protected final int _maxEntries;
|
|
|
|
public LRUMap(int i, int i2) {
|
|
this._initialEntries = i;
|
|
this._maxEntries = i2;
|
|
this._map = new PrivateMaxEntriesMap.Builder().initialCapacity(i).maximumCapacity(i2).concurrencyLevel(4).build();
|
|
}
|
|
|
|
@Override // com.fasterxml.jackson.databind.util.LookupCache
|
|
public void clear() {
|
|
this._map.clear();
|
|
}
|
|
|
|
@Override // com.fasterxml.jackson.databind.util.LookupCache
|
|
public void contents(BiConsumer<K, V> biConsumer) {
|
|
for (Map.Entry<K, V> entry : this._map.entrySet()) {
|
|
biConsumer.accept(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
@Override // com.fasterxml.jackson.databind.util.LookupCache
|
|
public LookupCache<K, V> emptyCopy() {
|
|
return new LRUMap(this._initialEntries, this._maxEntries);
|
|
}
|
|
|
|
@Override // com.fasterxml.jackson.databind.util.LookupCache
|
|
public V get(Object obj) {
|
|
return this._map.get(obj);
|
|
}
|
|
|
|
@Override // com.fasterxml.jackson.databind.util.LookupCache
|
|
public V put(K k, V v) {
|
|
return this._map.put(k, v);
|
|
}
|
|
|
|
@Override // com.fasterxml.jackson.databind.util.LookupCache
|
|
public V putIfAbsent(K k, V v) {
|
|
return this._map.putIfAbsent(k, v);
|
|
}
|
|
|
|
public Object readResolve() {
|
|
return new LRUMap(this._initialEntries, this._maxEntries);
|
|
}
|
|
|
|
@Override // com.fasterxml.jackson.databind.util.LookupCache
|
|
public int size() {
|
|
return this._map.size();
|
|
}
|
|
}
|