Package org.jppf.utils.collections
Class LRUMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.jppf.utils.collections.LRUMap<K,V>
- Type Parameters:
K- the type fo the keys.V- the type fo the values.
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>
A cache with an LRU eviction policy.
- Author:
- Laurent Cohen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Constructor Details
-
LRUMap
public LRUMap()Initialize this cache with a default max capacity of 1024. -
LRUMap
public LRUMap(int maxCapacity) Initialize this cache with the specified max capacity.- Parameters:
maxCapacity- the maximum capacity of this cache.
-
-
Method Details
-
removeEldestEntry
- Overrides:
removeEldestEntryin classLinkedHashMap<K,V>
-