Class LruCacheMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
top.untold.frostlumen.core.tool.LruCacheMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>, SequencedMap<K,V>

public class LruCacheMap<K,V> extends LinkedHashMap<K,V>
See Also:
  • Constructor Details

    • LruCacheMap

      public LruCacheMap(int maxSize, BiConsumer<K,V> onRemove)
    • LruCacheMap

      public LruCacheMap(int maxSize)
    • LruCacheMap

      public LruCacheMap(int initialCapacity, int maxSize, BiConsumer<K,V> onRemove)
  • Method Details

    • removeEldestEntry

      protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
      Overrides:
      removeEldestEntry in class LinkedHashMap<K,V>
    • getMaxSize

      public int getMaxSize()
    • setMaxSize

      public void setMaxSize(int maxSize)
    • setOnAutoRemove

      public void setOnAutoRemove(BiConsumer<K,V> onAutoRemove)