org.kuali.student.common.util
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.kuali.student.common.util.LRUMap<K,V>
Type Parameters:
K - Key
V - Value
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

public class LRUMap<K,V>
extends LinkedHashMap<K,V>

A Map implementation with a fixed maximum size of a least recently used (LRU) entry list using a LinkedHashMap.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
private  int maxSize
          Maximum size of map
private static long serialVersionUID
          Class serial version uid
 
Constructor Summary
LRUMap()
          Constructs a new LRU Map with a default maximum size of 50 entries.
LRUMap(int maxSize)
          Constructs a new LRU Map.
 
Method Summary
 boolean removeEldestEntry(Map.Entry<K,V> eldest)
          Removed oldest entry in map.
 
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

serialVersionUID

private static final long serialVersionUID
Class serial version uid

See Also:
Constant Field Values

maxSize

private int maxSize
Maximum size of map

Constructor Detail

LRUMap

public LRUMap()
Constructs a new LRU Map with a default maximum size of 50 entries.


LRUMap

public LRUMap(int maxSize)
Constructs a new LRU Map.

Parameters:
maxSize - Maximum size of LRU map.
Method Detail

removeEldestEntry

public boolean removeEldestEntry(Map.Entry<K,V> eldest)
Removed oldest entry in map.

Overrides:
removeEldestEntry in class LinkedHashMap<K,V>
Parameters:
eldest - Oldest entry to remove


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.