@Deprecated public abstract class CachingMapDecorator<K,V> extends Object implements Map<K,V>, Serializable
This class is an abstract template. Caching Map implementations should
subclass and override the create(key) method which encapsulates
expensive creation of a new object.
| 构造器和说明 |
|---|
CachingMapDecorator()
已过时。
Create a CachingMapDecorator with strong keys, using an underlying
synchronized Map.
|
CachingMapDecorator(boolean weak)
已过时。
Create a CachingMapDecorator, using an underlying synchronized Map.
|
CachingMapDecorator(boolean weak,
int size)
已过时。
Create a CachingMapDecorator with initial size, using an underlying
synchronized Map.
|
CachingMapDecorator(Map<K,V> targetMap)
已过时。
Create a CachingMapDecorator for the given Map.
|
CachingMapDecorator(Map<K,V> targetMap,
boolean synchronize,
boolean weak)
已过时。
Create a CachingMapDecorator for the given Map.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
已过时。
|
boolean |
containsKey(Object key)
已过时。
|
boolean |
containsValue(Object value)
已过时。
|
protected abstract V |
create(K key)
已过时。
Create a value to cache for the given key.
|
Set<Map.Entry<K,V>> |
entrySet()
已过时。
|
V |
get(Object key)
已过时。
Get value for key.
|
boolean |
isEmpty()
已过时。
|
Set<K> |
keySet()
已过时。
|
V |
put(K key,
V value)
已过时。
Put an object into the cache, possibly wrapping it with a weak reference.
|
void |
putAll(Map<? extends K,? extends V> map)
已过时。
|
V |
remove(Object key)
已过时。
|
int |
size()
已过时。
|
String |
toString()
已过时。
|
protected boolean |
useWeakValue(K key,
V value)
已过时。
Decide whether to use a weak reference for the value of the given
key-value pair.
|
Collection<V> |
values()
已过时。
|
public CachingMapDecorator()
public CachingMapDecorator(boolean weak)
weak - whether to use weak references for keys and valuespublic CachingMapDecorator(boolean weak,
int size)
weak - whether to use weak references for keys and valuessize - the initial cache sizepublic CachingMapDecorator(Map<K,V> targetMap)
The passed-in Map won't get synchronized explicitly, so make sure to pass in a properly synchronized Map, if desired.
targetMap - the Map to decoratepublic CachingMapDecorator(Map<K,V> targetMap, boolean synchronize, boolean weak)
The passed-in Map won't get synchronized explicitly unless you specify "synchronize" as "true".
targetMap - the Map to decoratesynchronize - whether to synchronize on the given Mapweak - whether to use weak references for valuespublic boolean containsKey(Object key)
containsKey 在接口中 Map<K,V>public boolean containsValue(Object value)
containsValue 在接口中 Map<K,V>public V put(K key, V value)
put 在接口中 Map<K,V>useWeakValue(Object, Object)protected boolean useWeakValue(K key, V value)
key - the candidate keyvalue - the candidate valuetrue in order to use a weak reference; false
otherwise.public V get(Object key)
This implementation is not synchronized: This is highly concurrent but does not guarantee unique instances in the cache, as multiple values for the same key could get created in parallel. Consider overriding this method to synchronize it, if desired.
get 在接口中 Map<K,V>create(Object)protected abstract V create(K key)
get if there
is no value cached already.key - the cache keyget(Object)Copyright © 2013 The Skfiy Open Association. All Rights Reserved.