K - key typeV - value typeCacheFactory instead and build a proper cache.@Deprecated @NotThreadSafe public class LRUMap<K,V> extends LinkedHashMap<K,V> implements Map<K,V>
LinkedHashMap that is access ordered AND constrained in size.
It is very important that any multi-threaded access to this class be externally synchronised
as even non mutative operations such as LinkedHashMap.get(Object) will cause internal modifications
to the map order.
LinkedHashMap,
Serialized FormAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Method and Description |
|---|---|
static <K,V> Map<K,V> |
newLRUMap(int capacity)
Deprecated.
Get a map that is access ordered and has the specified capacity.
|
protected boolean |
removeEldestEntry(Map.Entry<K,V> eldest)
Deprecated.
|
static <K,V> Map<K,V> |
synchronizedLRUMap(int capacity)
Deprecated.
Get a map that is access ordered and has the specified capacity that is thread-safe.
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic static <K,V> Map<K,V> newLRUMap(int capacity)
K - the key typeV - the value typecapacity - the maximum capacitypublic static <K,V> Map<K,V> synchronizedLRUMap(int capacity)
K - the key typeV - the value typecapacity - the maximum capacityprotected final boolean removeEldestEntry(Map.Entry<K,V> eldest)
removeEldestEntry in class LinkedHashMap<K,V>Copyright © 2002-2019 Atlassian. All Rights Reserved.