Package org.eclipse.jgit.util
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:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<K,V>
public class LRUMap<K,V> extends java.util.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
-
-
Field Summary
Fields Modifier and Type Field Description private int
limit
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description LRUMap(int initialCapacity, int limit)
Constructs an empty map which may contain at most the given amount of entries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
removeEldestEntry(java.util.Map.Entry<K,V> eldest)
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
limit
private final int limit
-
-