|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap
common.HashMultiMapDiff
public class HashMultiMapDiff
Implementation of MultiMapDiff that uses a hash map from objects HashSetDiffs.
| Nested Class Summary | |
|---|---|
protected class |
HashMultiMapDiff.ValueSet
|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface common.MultiMap |
|---|
MultiMap.EmptyMultiMap |
| Field Summary |
|---|
| Fields inherited from interface common.MultiMap |
|---|
EMPTY_MULTI_MAP |
| Constructor Summary | |
|---|---|
HashMultiMapDiff(MultiMap underlying)
Creates a new HashMultiMapDiff with the given underlying MultiMap. |
|
HashMultiMapDiff(MultiMap underlying,
boolean maintainOrder)
Creates a new HashMultiMapDiff with the given underlying MultiMap. |
|
| Method Summary | |
|---|---|
boolean |
add(java.lang.Object key,
java.lang.Object value)
Adds the given value to the set associated with the given key. |
boolean |
addAll(java.lang.Object key,
java.util.Set values)
Adds all elements of the given set to the set associated with the given key. |
void |
changeUnderlying()
Changes the underlying multi-map to equal this multi-map. |
void |
clear()
|
void |
clearChanges()
Resets this multi-map to be equal to the underlying multi-map. |
java.lang.Object |
clone()
Returns a shallow copy of this multi-map diff, expressed relative to the same underlying multi-map. |
boolean |
containsKey(java.lang.Object key)
|
protected java.util.Set |
emptySet()
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
Returns the set associated with the given key. |
java.util.Set |
getAddedValues(java.lang.Object key)
Returns the set of values that are associated with the given key in this multi-map and not in the underlying multi-map. |
java.util.Set |
getChangedKeys()
Returns the set of keys whose associated value sets are different in this multi-map and the underlying multi-map. |
protected java.util.Set |
getCurrent(java.lang.Object key)
|
java.util.Set |
getRemovedValues(java.lang.Object key)
Returns the set of values that are associated with the given key in the underlying multi-map but not in this multi-map. |
protected SetDiff |
newDiff(java.util.Set underlying)
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the given key with the given value, which must be a Set. |
java.lang.Object |
remove(java.lang.Object key)
|
boolean |
remove(java.lang.Object key,
java.lang.Object value)
Removes the given value from the set associated with the given key. |
boolean |
removeAll(java.lang.Object key,
java.util.Set values)
Removes all elements of the given set from the set associated with the given key. |
int |
size()
|
| Methods inherited from class java.util.AbstractMap |
|---|
containsValue, equals, hashCode, isEmpty, keySet, putAll, 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, values |
| Constructor Detail |
|---|
public HashMultiMapDiff(MultiMap underlying)
public HashMultiMapDiff(MultiMap underlying,
boolean maintainOrder)
maintainOrder is true, uses linked data structures
so that the order of iteration is predictable.
| Method Detail |
|---|
public int size()
size in interface java.util.Mapsize in class java.util.AbstractMappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.MapcontainsKey in class java.util.AbstractMappublic java.lang.Object get(java.lang.Object key)
MultiMapput method is called or if all the values for the
given key are removed.
get in interface MultiMapget in interface java.util.Mapget in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
MultiMap
put in interface MultiMapput in interface java.util.Mapput in class java.util.AbstractMap
public boolean add(java.lang.Object key,
java.lang.Object value)
MultiMap
add in interface MultiMap
public boolean addAll(java.lang.Object key,
java.util.Set values)
MultiMap
addAll in interface MultiMappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapremove in class java.util.AbstractMap
public boolean remove(java.lang.Object key,
java.lang.Object value)
MultiMap
remove in interface MultiMap
public boolean removeAll(java.lang.Object key,
java.util.Set values)
MultiMap
removeAll in interface MultiMappublic void clear()
clear in interface java.util.Mapclear in class java.util.AbstractMappublic java.util.Set entrySet()
entrySet in interface java.util.MapentrySet in class java.util.AbstractMappublic java.util.Set getChangedKeys()
MultiMapDiffThe returned set may or may not be kept up to date as changes are made to this MultiMapDiff.
getChangedKeys in interface MultiMapDiffpublic java.util.Set getAddedValues(java.lang.Object key)
MultiMapDiffThe returned set may or may not be kept up to date as changes are made to this MultiMapDiff.
getAddedValues in interface MultiMapDiffpublic java.util.Set getRemovedValues(java.lang.Object key)
MultiMapDiffThe returned set may or may not be kept up to date as changes are made to this MultiMapDiff.
getRemovedValues in interface MultiMapDiffpublic void changeUnderlying()
changeUnderlying in interface MultiMapDiffpublic void clearChanges()
clearChanges in interface MultiMapDiffpublic java.lang.Object clone()
clone in class java.util.AbstractMapprotected java.util.Set emptySet()
protected SetDiff newDiff(java.util.Set underlying)
protected java.util.Set getCurrent(java.lang.Object key)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||