public class LruCache<K,V> extends LinkedHashMap<K,V> implements Cache<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
LruCache(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(K key,
V value)
Stores an entry into the cache.
|
long |
getCapacity()
Returns the capacity of the cache.
|
V |
getElement(K key)
Retrieves an entry for the cache.
|
long |
getSize() |
protected boolean |
removeEldestEntry(Map.Entry<K,V> eldest) |
V |
removeElement(K key)
Removes an entry from the cache.
|
clear, containsValue, getclone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCode, toStringpublic V getElement(K key)
CachegetElement in interface Cache<K,V>public void addElement(K key, V value)
CacheaddElement in interface Cache<K,V>public V removeElement(K key)
CacheremoveElement in interface Cache<K,V>key - The entry to return.public long getCapacity()
CachegetCapacity in interface Cache<K,V>public long getSize()
protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
removeEldestEntry in class LinkedHashMap<K,V>Copyright © 2007-2012. All Rights Reserved.