|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
edu.stanford.nlp.util.DeltaMap
public class DeltaMap
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 class java.util.AbstractMap |
---|
AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
DeltaMap(Map originalMap)
|
|
DeltaMap(Map originalMap,
MapFactory mf)
This is very cheap. |
Method Summary | |
---|---|
void |
clear()
This is more expensive than normal. |
boolean |
containsKey(Object key)
This is expensive. |
Set |
entrySet()
This is cheap. |
Object |
get(Object key)
This may cost twice what it would in the original Map. |
static void |
main(String[] args)
For testing only. |
Object |
put(Object key,
Object value)
This may cost twice what it would in the original Map because we have to find the original value for this key. |
Object |
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 |
Methods inherited from interface java.util.Map |
---|
containsValue, equals, hashCode, isEmpty, keySet, putAll, size, values |
Constructor Detail |
---|
public DeltaMap(Map originalMap, MapFactory mf)
originalMap
- will serve as the basis for this DeltaMappublic DeltaMap(Map originalMap)
Method Detail |
---|
public boolean containsKey(Object key)
containsKey
in interface Map
containsKey
in class AbstractMap
key
- key whose presence in this map is to be tested.
public Object get(Object key)
get
in interface Map
get
in class AbstractMap
key
- key whose associated value is to be returned.
public Object put(Object key, Object value)
put
in interface Map
put
in class AbstractMap
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
public Object remove(Object key)
remove
in interface Map
remove
in class AbstractMap
public void clear()
clear
in interface Map
clear
in class AbstractMap
public Set entrySet()
entrySet
in interface Map
entrySet
in class AbstractMap
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 |