K
- the type of keys maintained by this mapV
- the type of mapped valuespublic final class CacheMap<K,V> extends LinkedHashMap<K,V>
When the maximum size limit has been reached, the least-recently accessed entry will be removed whenever a new entry is added.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Method and Description |
---|---|
static <K,V> Map<K,V> |
createCache(int maxSize)
Returns a size-limited map of keys to values.
|
protected boolean |
removeEldestEntry(Map.Entry<K,V> eldest) |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
public static <K,V> Map<K,V> createCache(int maxSize)
K
- the type of keys maintained by this mapV
- the type of mapped valuesmaxSize
- the maximum size restriction to enforce on the returned mapprotected boolean removeEldestEntry(Map.Entry<K,V> eldest)
removeEldestEntry
in class LinkedHashMap<K,V>
OakGP Genetic Programming Framework