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, get
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
equals, hashCode, toString
public 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-2015 Atlassian. All Rights Reserved.