Package scriptella.util
Class LRUMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
scriptella.util.LRUMap<K,V>
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>
Represents LRU Map implementation based on
LinkedHashMap.- Version:
- 1.0
- Author:
- Fyodor Kupolov
- 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
Modifier and TypeMethodDescriptionprotected voidonEldestEntryRemove(Map.Entry<K, V> eldest) Invoked when eldest entry is about to be removed.protected booleanremoveEldestEntry(Map.Entry<K, V> eldest) 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(int size)
-
-
Method Details
-
removeEldestEntry
- Overrides:
removeEldestEntryin classLinkedHashMap<K,V>
-
onEldestEntryRemove
Invoked when eldest entry is about to be removed.- Parameters:
eldest- eldest entry.
-