Class LRUMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.eclipse.jgit.util.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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • limit

      private final int limit
  • Constructor Details

    • 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
  • Method Details