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