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 mapV- the type of mapped values
- All Implemented Interfaces:
Serializable, Cloneable, Map<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:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionLRUMap(int initialCapacity, int limit) Constructs an empty map which may contain at most the given amount of entries. -
Method Summary
Methods inherited from class LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesMethods inherited from class HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class AbstractMap
equals, hashCode, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
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 capacitylimit- the number of entries the map should have at most
-
-
Method Details
-
removeEldestEntry
- Overrides:
removeEldestEntryin classLinkedHashMap<K,V>
-