Package org.eclipse.tycho.core.shared
Class LRUCache<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<K,V>
-
- org.eclipse.tycho.core.shared.LRUCache<K,V>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<K,V>
public class LRUCache<K,V> extends java.util.LinkedHashMap<K,V>
A LinkedHashMap with fixed maximum size which can be used as a cache. Least recently used (LRU) entries will be removed first if the size limit is reached.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
maxSize
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description LRUCache(int maxSize)
-
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
-
maxSize
private final int maxSize
-
-