Package org.openstreetmap.josm.gui.util
Class LruCache<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<K,V>
-
- org.openstreetmap.josm.gui.util.LruCache<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 final class LruCache<K,V> extends java.util.LinkedHashMap<K,V>
LRU cache (least recently used)
-
-
Field Summary
Fields Modifier and Type Field Description private int
capacity
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description LruCache(int capacity)
Constructs an emptyLruCache
instance with the given capacity
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
hashCode()
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
-
capacity
private final int capacity
-
-
Constructor Detail
-
LruCache
public LruCache(int capacity)
Constructs an emptyLruCache
instance with the given capacity- Parameters:
capacity
- the capacity
-
-
Method Detail
-
removeEldestEntry
protected boolean removeEldestEntry(java.util.Map.Entry<K,V> eldest)
-
equals
public boolean equals(java.lang.Object o)
-
-