K
- The key.V
- The value.public final class LruCache<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
A simple concurrent implementation of a least-recently-used cache.
This cache is keeps a maximal number of items in memory and removes the least-recently-used item, when new items are added.
Constructor and Description |
---|
LruCache(int maxEntries) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
compute(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
computeIfAbsent(K key,
java.util.function.Function<? super K,? extends V> mappingFunction) |
V |
computeIfPresent(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction) |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key) |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
merge(K key,
V value,
java.util.function.BiFunction<? super V,? super V,? extends V> remappingFunction) |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
putIfAbsent(K key,
V value) |
V |
remove(java.lang.Object key) |
boolean |
remove(java.lang.Object key,
java.lang.Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
int |
size() |
java.util.Collection<V> |
values() |
public final boolean containsKey(java.lang.Object key)
public final boolean containsValue(java.lang.Object value)
public final V remove(java.lang.Object key)
public final java.util.Collection<V> values()
public final boolean remove(java.lang.Object key, java.lang.Object value)
public final V computeIfAbsent(K key, java.util.function.Function<? super K,? extends V> mappingFunction)
public final V computeIfPresent(K key, java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
public final V compute(K key, java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
Copyright © 2014–2019 XMPP.rocks. All rights reserved.