org.terrier.structures.collections
Class LRUMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<K,V>
              extended by org.terrier.structures.collections.LRUMap<K,V>
Type Parameters:
K - type of the key
V - 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 Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
static int DEFAULT_SIZE
          DEFAULT_SIZE
 
Constructor Summary
LRUMap()
          default constructor
LRUMap(int _maxSize)
          constructor
LRUMap(java.lang.String sMaxSize)
          constructor
 
Method Summary
protected  boolean removeEldestEntry(java.util.Map.Entry<K,V> eldest)
           
 
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
 

Field Detail

DEFAULT_SIZE

public static final int DEFAULT_SIZE
DEFAULT_SIZE

See Also:
Constant Field Values
Constructor Detail

LRUMap

public LRUMap()
default constructor


LRUMap

public LRUMap(java.lang.String sMaxSize)
constructor

Parameters:
sMaxSize -

LRUMap

public LRUMap(int _maxSize)
constructor

Parameters:
_maxSize -
Method Detail

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