Class LRUMap<K,​V>

  • Type Parameters:
    K - Key type
    V - Value type
    All Implemented Interfaces:
    Serializable, Cloneable, Map<K,​V>

    public final class LRUMap<K,​V>
    extends LinkedHashMap<K,​V>

    A Bounded map that keeps the last recently N used items.

    Author:
    David B. Bracewell
    See Also:
    Serialized Form
    • Constructor Detail

      • LRUMap

        public LRUMap()
        Instantiates a new LRU map with a max size of Integer.MAX_VALUE.
      • LRUMap

        public LRUMap​(int maxSize)
        Instantiates a new lRU map.
        Parameters:
        maxSize - the max size
    • Method Detail

      • create

        public static <K,​V> LRUMap<K,​V> create​(int maxSize)
        Creates a new LRU Map.
        Type Parameters:
        K - the key type
        V - the value type
        Returns:
        the map
      • maxSize

        public int maxSize()
        Returns:
        The maximum size of the map