org.terrier.structures.collections
Class LRUMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.terrier.structures.collections.LRUMap<K,V>
- Type Parameters:
K
- type of the keyV
- type of the parameter
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<K,V>
public final class LRUMap<K,V>
- extends java.util.LinkedHashMap<K,V>
A map with a fixed maximum size. The eldest entry will be removed
when the maximum size is reached
- Since:
- 3.0
- Author:
- Rodrygo Santos
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Constructor Summary |
LRUMap()
default constructor |
LRUMap(int _maxSize)
constructor |
LRUMap(java.lang.String sMaxSize)
constructor |
Methods inherited from class java.util.LinkedHashMap |
clear, containsValue, get |
Methods inherited from class java.util.HashMap |
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
DEFAULT_SIZE
public static final int DEFAULT_SIZE
- DEFAULT_SIZE
- See Also:
- Constant Field Values
LRUMap
public LRUMap()
- default constructor
LRUMap
public LRUMap(java.lang.String sMaxSize)
- constructor
- Parameters:
sMaxSize
-
LRUMap
public LRUMap(int _maxSize)
- constructor
- Parameters:
_maxSize
-
removeEldestEntry
protected boolean removeEldestEntry(java.util.Map.Entry<K,V> eldest)
- Overrides:
removeEldestEntry
in class java.util.LinkedHashMap<K,V>
Terrier 3.5. Copyright © 2004-2011 University of Glasgow