public class LruMap<A,B> extends LinkedHashMap<A,B>
Modifier and Type | Class and Description |
---|---|
static interface |
LruMap.CacheEvictionCallback<K,V> |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
LruMap(int maxSize) |
LruMap(int maxSize,
LruMap.CacheEvictionCallback evictionCallback)
Creates an LRU map that will call back before data is removed from the map.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
removeEldestEntry(Map.Entry<A,B> 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 LruMap(int maxSize)
public LruMap(int maxSize, LruMap.CacheEvictionCallback evictionCallback)
maxSize
- max capacity for the mapevictionCallback
- callback to be called before removing dataprotected boolean removeEldestEntry(Map.Entry<A,B> eldest)
removeEldestEntry
in class LinkedHashMap<A,B>
Copyright © 2023 The Apache Software Foundation. All rights reserved.