org.owasp.webscarab.util
Class MRUCache
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap
org.owasp.webscarab.util.MRUCache
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map
public class MRUCache
- extends java.util.LinkedHashMap
maintains a Most-Recently-Used cache of its entries, up to the max size specified
- Author:
- knoppix
- See Also:
- Serialized Form
Constructor Summary |
MRUCache(int maxSize)
Creates a new instance of MRUCache, with an initial size of 16, and
a load factor of 0.75 |
MRUCache(int initialCapacity,
int maxSize)
Creates a new instance of MRUCache, with a load factor of 0.75 |
MRUCache(int initialCapacity,
int maxSize,
float loadFactor)
Creates a new instance of MRUCache |
Method Summary |
protected boolean |
removeEldestEntry(java.util.Map.Entry eldest)
called to determine whether the eldest entry should be removed. |
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 |
MRUCache
public MRUCache(int maxSize)
- Creates a new instance of MRUCache, with an initial size of 16, and
a load factor of 0.75
- Parameters:
maxSize
- the maximum size of the cache
MRUCache
public MRUCache(int initialCapacity,
int maxSize)
- Creates a new instance of MRUCache, with a load factor of 0.75
- Parameters:
initialCapacity
- the preferred initial capacitymaxSize
- the maximum size of the cache
MRUCache
public MRUCache(int initialCapacity,
int maxSize,
float loadFactor)
- Creates a new instance of MRUCache
- Parameters:
loadFactor
- the preferred load factorinitialCapacity
- the preferred initial capacitymaxSize
- the maximum size of the cache
removeEldestEntry
protected boolean removeEldestEntry(java.util.Map.Entry eldest)
- called to determine whether the eldest entry should be removed. Eldest is defined
in terms of access order, so a more recently used entry will stay "young"
- Overrides:
removeEldestEntry
in class java.util.LinkedHashMap
- Parameters:
eldest
- the entry
- Returns:
- true if this entry should be removed, false otherwise