|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jabb.util.col.PutOnGetMap<K,V>
K - Type of the key of the Map entriesV - Type of the value of the Map entries
public class PutOnGetMap<K,V>
Encapsulates Map so that a new entry is put in to the Map whenever
there is a get for a non-existing entry.
把Map进一步封装,使得每次get的时候,如果没有,就自动put。
Please note that only these methods are synchronized: get/put/putAll/remove/clear.
注意只有这几个方法是同步的:get/put/putAll/remove/clear。
Although PutOnGetMap implemented SortedMap and NavigableMap, if the encapsulated Map does not support those interfaces, then if any method of those interfaces was called, Exception will be thrown.
虽然PutOnGetMap实现了SortedMap与NavigableMap接口, 但是如果被封装的Map本身不支持这些接口, 那么当运行时调用这些接口所特有的方法的时候,会抛出Exception。
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected Map<K,V> |
map
Deprecated. |
protected Object |
structureLock
Deprecated. |
protected Class<?> |
valueClass
Deprecated. |
protected Constructor<?> |
valueConstructor
Deprecated. |
protected Object |
valueParameter
Deprecated. |
| Constructor Summary | |
|---|---|
PutOnGetMap(Class<? extends Map> mapClazz,
Class<? extends V> valueClazz)
Deprecated. Constructs an instance with specified Map Class and value Class. 给定Map的类以及value的类,封装出一个“每次get的时候,如果没有,就自动put”的实例。 |
|
PutOnGetMap(Class<? extends Map> mapClazz,
Class<? extends V> valueClazz,
Object... valueParams)
Deprecated. Constructs an instance with specified Map Class, value Class and the constructor parameter of the value Class. 给定Map的类、value的类以及value类构造方法的参数,封装出一个“每次get的时候,如果没有,就自动put”的实例。 |
|
PutOnGetMap(Class<? extends Map> mapClazz,
Class<? extends V> valueClazz,
Object valueParam)
Deprecated. Constructs an instance with specified Map Class, value Class and the constructor parameter of the value Class. 给定Map的类、value的类以及value类构造方法的参数,封装出一个“每次get的时候,如果没有,就自动put”的实例。 |
|
PutOnGetMap(Map<K,V> originalMap,
Class<? extends V> valueClazz)
Deprecated. Constructs an instance with specified Map instance and value Class. 给定Map实例以及value的类,把一个普通的Map实例封装成“每次get的时候,如果没有,就自动put”。 |
|
| Method Summary | |
|---|---|
Map.Entry<K,V> |
ceilingEntry(K key)
Deprecated. |
K |
ceilingKey(K key)
Deprecated. |
void |
clear()
Deprecated. |
Comparator<? super K> |
comparator()
Deprecated. |
boolean |
containsKey(Object obj)
Deprecated. |
boolean |
containsValue(Object obj)
Deprecated. |
NavigableSet<K> |
descendingKeySet()
Deprecated. |
NavigableMap<K,V> |
descendingMap()
Deprecated. |
Set<Map.Entry<K,V>> |
entrySet()
Deprecated. |
Map.Entry<K,V> |
firstEntry()
Deprecated. |
K |
firstKey()
Deprecated. |
Map.Entry<K,V> |
floorEntry(K key)
Deprecated. |
K |
floorKey(K key)
Deprecated. |
V |
get(Object key)
Deprecated. Get the value object corresponding to the key object specified, if such entry does not exist in the Map, then create one and put into the Map and return the value object in the newly created entry. 取得key所对应的value,如果目前在Map里没有,则在Map里新建一个并返回新建 的这个value对象。 |
Map<K,V> |
getMap()
Deprecated. Get the encapsulated Map instance. 获得最初被封装的那个Map。 |
SortedMap<K,V> |
headMap(K key)
Deprecated. |
NavigableMap<K,V> |
headMap(K arg0,
boolean arg1)
Deprecated. |
Map.Entry<K,V> |
higherEntry(K arg0)
Deprecated. |
K |
higherKey(K arg0)
Deprecated. |
boolean |
isEmpty()
Deprecated. |
Set<K> |
keySet()
Deprecated. |
Map.Entry<K,V> |
lastEntry()
Deprecated. |
K |
lastKey()
Deprecated. |
Map.Entry<K,V> |
lowerEntry(K arg0)
Deprecated. |
K |
lowerKey(K arg0)
Deprecated. |
NavigableSet<K> |
navigableKeySet()
Deprecated. |
Map.Entry<K,V> |
pollFirstEntry()
Deprecated. |
Map.Entry<K,V> |
pollLastEntry()
Deprecated. |
V |
put(K key,
V value)
Deprecated. |
void |
putAll(Map<? extends K,? extends V> anotherMap)
Deprecated. |
V |
remove(Object obj)
Deprecated. |
int |
size()
Deprecated. |
NavigableMap<K,V> |
subMap(K arg0,
boolean arg1,
K arg2,
boolean arg3)
Deprecated. |
SortedMap<K,V> |
subMap(K from,
K to)
Deprecated. |
SortedMap<K,V> |
tailMap(K key)
Deprecated. |
NavigableMap<K,V> |
tailMap(K arg0,
boolean arg1)
Deprecated. |
Collection<V> |
values()
Deprecated. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Field Detail |
|---|
protected Map<K,V> map
protected Class<?> valueClass
protected Constructor<?> valueConstructor
protected Object valueParameter
protected Object structureLock
| Constructor Detail |
|---|
public PutOnGetMap(Map<K,V> originalMap,
Class<? extends V> valueClazz)
originalMap - The Map instance that will be encapsulated.valueClazz - Class of the value of the Map entry.
public PutOnGetMap(Class<? extends Map> mapClazz,
Class<? extends V> valueClazz)
mapClazz - The Map Class that its instance will be created and encapsulated.valueClazz - Class of the value of the Map entry.
public PutOnGetMap(Class<? extends Map> mapClazz,
Class<? extends V> valueClazz,
Object valueParam)
mapClazz - The Map Class that its instance will be created and encapsulated.valueClazz - Class of the value of the Map entry.valueParam - Constructor parameter for the value Class.
public PutOnGetMap(Class<? extends Map> mapClazz,
Class<? extends V> valueClazz,
Object... valueParams)
mapClazz - The Map Class that its instance will be created and encapsulated.valueClazz - Class of the value of the Map entry.valueParams - Constructor parameter for the value Class.| Method Detail |
|---|
public Map<K,V> getMap()
public V get(Object key)
get in interface Map<K,V>key - The key object that will be used to look for the value object.
public V put(K key,
V value)
put in interface Map<K,V>public void putAll(Map<? extends K,? extends V> anotherMap)
putAll in interface Map<K,V>public V remove(Object obj)
remove in interface Map<K,V>public void clear()
clear in interface Map<K,V>public boolean containsKey(Object obj)
containsKey in interface Map<K,V>public boolean containsValue(Object obj)
containsValue in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>entrySet in interface SortedMap<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>public Set<K> keySet()
keySet in interface Map<K,V>keySet in interface SortedMap<K,V>public int size()
size in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>values in interface SortedMap<K,V>public Comparator<? super K> comparator()
comparator in interface SortedMap<K,V>public K firstKey()
firstKey in interface SortedMap<K,V>public SortedMap<K,V> headMap(K key)
headMap in interface NavigableMap<K,V>headMap in interface SortedMap<K,V>public K lastKey()
lastKey in interface SortedMap<K,V>
public SortedMap<K,V> subMap(K from,
K to)
subMap in interface NavigableMap<K,V>subMap in interface SortedMap<K,V>public SortedMap<K,V> tailMap(K key)
tailMap in interface NavigableMap<K,V>tailMap in interface SortedMap<K,V>public Map.Entry<K,V> ceilingEntry(K key)
ceilingEntry in interface NavigableMap<K,V>public K ceilingKey(K key)
ceilingKey in interface NavigableMap<K,V>public NavigableSet<K> descendingKeySet()
descendingKeySet in interface NavigableMap<K,V>public NavigableMap<K,V> descendingMap()
descendingMap in interface NavigableMap<K,V>public Map.Entry<K,V> firstEntry()
firstEntry in interface NavigableMap<K,V>public Map.Entry<K,V> floorEntry(K key)
floorEntry in interface NavigableMap<K,V>public K floorKey(K key)
floorKey in interface NavigableMap<K,V>
public NavigableMap<K,V> headMap(K arg0,
boolean arg1)
headMap in interface NavigableMap<K,V>public Map.Entry<K,V> higherEntry(K arg0)
higherEntry in interface NavigableMap<K,V>public K higherKey(K arg0)
higherKey in interface NavigableMap<K,V>public Map.Entry<K,V> lastEntry()
lastEntry in interface NavigableMap<K,V>public Map.Entry<K,V> lowerEntry(K arg0)
lowerEntry in interface NavigableMap<K,V>public K lowerKey(K arg0)
lowerKey in interface NavigableMap<K,V>public NavigableSet<K> navigableKeySet()
navigableKeySet in interface NavigableMap<K,V>public Map.Entry<K,V> pollFirstEntry()
pollFirstEntry in interface NavigableMap<K,V>public Map.Entry<K,V> pollLastEntry()
pollLastEntry in interface NavigableMap<K,V>
public NavigableMap<K,V> subMap(K arg0,
boolean arg1,
K arg2,
boolean arg3)
subMap in interface NavigableMap<K,V>
public NavigableMap<K,V> tailMap(K arg0,
boolean arg1)
tailMap in interface NavigableMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||