|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,V>
edu.stanford.nlp.util.DeltaMap<K,V>
public class DeltaMap<K,V>
A Map which wraps an original Map, and only stores the changes (deltas) from the original Map. This increases Map access time (roughly doubles it) but eliminates Map creation time and decreases memory usage (if you're keeping the original Map in memory anyway).
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
DeltaMap(Map<K,V> originalMap)
|
|
DeltaMap(Map<K,V> originalMap,
MapFactory<K,V> mf)
This is very cheap. |
Method Summary | |
---|---|
void |
clear()
This is more expensive than normal. |
boolean |
containsKey(Object key)
This is more expensive. |
Set<Map.Entry<K,V>> |
entrySet()
This is cheap. |
V |
get(Object key)
This may cost twice what it would in the original Map. |
static void |
main(String[] args)
For testing only. |
V |
put(K key,
V value)
This may cost twice what it would in the original Map because we have to find the original value for this key. |
V |
remove(Object key)
|
Methods inherited from class java.util.AbstractMap |
---|
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DeltaMap(Map<K,V> originalMap, MapFactory<K,V> mf)
originalMap
- will serve as the basis for this DeltaMappublic DeltaMap(Map<K,V> originalMap)
Method Detail |
---|
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
key
- key whose presence in this map is to be tested.
public V get(Object key)
get
in interface Map<K,V>
get
in class AbstractMap<K,V>
key
- key whose associated value is to be returned.
public V put(K key, V value)
put
in interface Map<K,V>
put
in class AbstractMap<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
public V remove(Object key)
remove
in interface Map<K,V>
remove
in class AbstractMap<K,V>
public void clear()
clear
in interface Map<K,V>
clear
in class AbstractMap<K,V>
public Set<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
entrySet
in class AbstractMap<K,V>
public static void main(String[] args)
args
- from command line
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |