public class MRUCache<KeyType,ValueType>
extends java.util.Dictionary<KeyType,ValueType>
equals()
method on each key.Constructor and Description |
---|
MRUCache()
Creates an MRU Cache with size 500
|
MRUCache(int maximumSize)
Creates an MRU Cache with the specified maximum size
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanCachedValue(KeyType key,
ValueType value)
Release all claimed resources.
|
ValueType |
computeIfAbsent(KeyType key,
java.util.function.Function<? super KeyType,? extends ValueType> mappingFunction) |
java.util.Enumeration<ValueType> |
elements()
Returns an enumeration of the elements in the cache
|
ValueType |
get(java.lang.Object key)
Retrieve the object in the list that has this key
|
protected int |
getMaximumSize() |
boolean |
isEmpty()
Returns true if the number of objects in the cache is 0 or less.
|
java.util.Enumeration<KeyType> |
keys()
Returns an enumeration of the keys in the cache
|
ValueType |
put(KeyType key,
ValueType element)
Puts an object in the cache, by its key.
|
ValueType |
remove(java.lang.Object key)
Remove the object with the specified key from the cache.
|
protected void |
setMaximumSize(int maxSize) |
int |
size()
Returns the number of objects in the cache.
|
java.lang.String |
toString() |
public MRUCache(int maximumSize)
public MRUCache()
public boolean isEmpty()
public ValueType remove(java.lang.Object key)
public int size()
public ValueType get(java.lang.Object key)
public ValueType put(KeyType key, ValueType element)
public ValueType computeIfAbsent(KeyType key, java.util.function.Function<? super KeyType,? extends ValueType> mappingFunction)
protected void cleanCachedValue(KeyType key, ValueType value)
key
- Cache keyvalue
- Cache Value whose resources needs to be releasedpublic java.util.Enumeration<ValueType> elements()
public java.util.Enumeration<KeyType> keys()
public java.lang.String toString()
toString
in class java.lang.Object
protected int getMaximumSize()
protected void setMaximumSize(int maxSize)