|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap
net.didion.jwnl.util.cache.LRUCache
public class LRUCache
A fixed-capacity Cache that stores the most recently used elements. Once the cache reaches
capacity, the least recently used elements will be removed.
| Constructor Summary | |
|---|---|
LRUCache(int capacity)
|
|
| Method Summary | |
|---|---|
int |
getCapacity()
Returns the maximum number of elements the cache can hold. |
int |
getSize()
Returns the current size of the cache. |
boolean |
isFull()
|
int |
setCapacity(int capacity)
Set the maximum number of elements the cache can hold. |
| 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 |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.didion.jwnl.util.cache.Cache |
|---|
clear, get, put, remove |
| Methods inherited from interface java.util.Map |
|---|
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
| Constructor Detail |
|---|
public LRUCache(int capacity)
capacity - the maximum number of elements that can be contained in the cache.| Method Detail |
|---|
public boolean isFull()
public int setCapacity(int capacity)
Cache
setCapacity in interface Cachepublic int getCapacity()
Cache
getCapacity in interface Cachepublic int getSize()
Cache
getSize in interface Cache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||