|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.util.LRUCache<K,V>
public class LRUCache<K,V>
This class implements a Generic LRU Cache. The cache is not thread-safe.
Nested Class Summary | |
---|---|
protected class |
LRUCache.CacheNode<K,V>
cache node object wrapper |
Constructor Summary | |
---|---|
LRUCache(int size)
Constructor for the LRUCache object |
Method Summary | |
---|---|
void |
clear()
clear the cache |
boolean |
contains(K key)
|
V |
get(K key)
retrieve an object from cache |
protected Iterator<V> |
iterator(int size)
|
void |
put(K key,
V value)
puts an object into cache |
V |
remove(K key)
remove an object from cache |
int |
size()
returns the number of elements currently in cache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LRUCache(int size)
size
- Description of the ParameterMethod Detail |
---|
public void clear()
public int size()
public V get(K key)
key
- key
public boolean contains(K key)
protected Iterator<V> iterator(int size)
public void put(K key, V value)
key
- key to store value byvalue
- object to insertpublic V remove(K key)
key
- key
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |