Key - The key type.Value - The value type.public final class LruCache<Key,Value> extends LinkedHashMap<Key,Value>
LruCache is a LinkedHashMap that is configured to hold it's
Entries in access order and evicts the least recently accessed
Map.Entry, if the configured cache size is exceeded.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
LruCache(int cacheSize)
Creates a new
LruCache without a LruCacheListener. |
LruCache(int cacheSize,
LruCacheListener<Key,Value> listener)
Creates a new
LruCache. |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
removeEldestEntry(Map.Entry<Key,Value> eldest) |
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, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic LruCache(int cacheSize)
throws IllegalArgumentException
LruCache without a LruCacheListener.cacheSize - The cache size to be used.IllegalArgumentException - If the given cache size is negative.public LruCache(int cacheSize,
LruCacheListener<Key,Value> listener)
throws IllegalArgumentException
LruCache.cacheSize - The cache size to be used.listener - The LruCacheListener to be used, or null, if
no LruCacheListener should be used.IllegalArgumentException - If the given cache size is negative.protected boolean removeEldestEntry(Map.Entry<Key,Value> eldest)
removeEldestEntry in class LinkedHashMap<Key,Value>Copyright © 2016–2017 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.