org.kuali.student.common.util
Class LRUMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.kuali.student.common.util.LRUMap<K,V>
- Type Parameters:
K
- KeyV
- 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
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. |
Methods inherited from interface java.util.Map |
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
serialVersionUID
private static final long serialVersionUID
- Class serial version uid
- See Also:
- Constant Field Values
maxSize
private int maxSize
- Maximum size of map
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.
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.