T - value type@ThreadSafe
public final class LRUCache<T>
extends java.lang.Object
| Constructor and Description |
|---|
LRUCache(int maxSize) |
| Modifier and Type | Method and Description |
|---|---|
T |
add(java.lang.String key,
T value)
Adds an entry to the cache, evicting the earliest entry if necessary.
|
void |
clear() |
T |
get(java.lang.String key)
Returns the value of the given key; or null of no such entry exists.
|
int |
getMaxSize()
Returns the maximum size of the cache.
|
T |
remove(java.lang.String key) |
int |
size()
Returns the current size of the cache.
|
java.lang.String |
toString() |
public LRUCache(int maxSize)
maxSize - the maximum number of entries of the cachepublic T add(java.lang.String key, T value)
public T get(java.lang.String key)
public int size()
public int getMaxSize()
public void clear()
public T remove(java.lang.String key)
public java.lang.String toString()
toString in class java.lang.Object