K - type for the keyV - type for the valuepublic interface Cache<K,V>
soft references. Because of the quirks of some platforms,
it is better to use this Cache API instead of a WeakHashMap or a Map with weak or
soft references.| Modifier and Type | Method | Description |
|---|---|---|
V |
get(K key) |
Get the value for the specified key, or null when there is no such key.
|
void |
put(K key,
V value) |
Stores a key-value pair in the cache.
|
boolean |
remove(K key) |
Remove the entry associated with this key.
|
void |
removeAll() |
Remove all entries from the cache
|
V get(K key)
key - the key for which we need the valuenull in case there is no
value corresponding to this key.void put(K key, V value)
NullPointerException will be
thrown if the key or the value are null.key - the key, should not be nullvalue - the value, should not be nullboolean remove(K key)
key - the key for which the entry is requestedvoid removeAll()