public interface Cache<K,V> extends Iterable<Cache.Entry<K,V>>
| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
Cache.Entry<K,V>
A map entry (key-value pair)
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
Removes all of the mappings from this cache (optional operation).
|
V |
get(K k)
Returns the value to which the specified key is mapped,
or
null if this cache contains no mapping for the key. |
void |
put(K k,
V v)
Associates the specified value with the specified key in this cache.
|
V |
remove(K k)
Removes the mapping for a key from this cache if it is present
(optional operation).
|
int |
size()
Returns the number of key-value mappings in this cache.
|
forEach, iterator, spliteratorV get(K k)
null if this cache contains no mapping for the key.k - the key whose associated value is to be returnednull if this cache contains no mapping for the keyvoid put(K k, V v)
k - key with which the specified value is to be associated
the key must not be nullv - value to be associated with the specified keyV remove(K k)
k - key whose mapping is to be removed from the cachevoid clear()
int size()
Copyright © 2020. All rights reserved.