Class LRUMap<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this map
    V - the type of mapped values
    All Implemented Interfaces:
    Serializable, Cloneable, Map<K,​V>

    public class LRUMap<K,​V>
    extends LinkedHashMap<K,​V>
    Map with only up to n entries. If a new entry is added so that the map contains more than those n entries the least-recently used entry is removed from the map.
    Since:
    5.4
    See Also:
    Serialized Form
    • Constructor Detail

      • LRUMap

        public LRUMap​(int initialCapacity,
                      int limit)
        Constructs an empty map which may contain at most the given amount of entries.
        Parameters:
        initialCapacity - the initial capacity
        limit - the number of entries the map should have at most