|
|||||||||
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.Map
size
in class java.util.AbstractMap
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
containsKey
in class java.util.AbstractMap
public java.lang.Object get(java.lang.Object key)
MultiMap
put
method is called or if all the values for the
given key are removed.
get
in interface MultiMap
get
in interface java.util.Map
get
in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
MultiMap
put
in interface MultiMap
put
in interface java.util.Map
put
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 MultiMap
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
remove
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 MultiMap
public void clear()
clear
in interface java.util.Map
clear
in class java.util.AbstractMap
public java.util.Set entrySet()
entrySet
in interface java.util.Map
entrySet
in class java.util.AbstractMap
public java.util.Set getChangedKeys()
MultiMapDiff
The returned set may or may not be kept up to date as changes are made to this MultiMapDiff.
getChangedKeys
in interface MultiMapDiff
public java.util.Set getAddedValues(java.lang.Object key)
MultiMapDiff
The returned set may or may not be kept up to date as changes are made to this MultiMapDiff.
getAddedValues
in interface MultiMapDiff
public java.util.Set getRemovedValues(java.lang.Object key)
MultiMapDiff
The returned set may or may not be kept up to date as changes are made to this MultiMapDiff.
getRemovedValues
in interface MultiMapDiff
public void changeUnderlying()
changeUnderlying
in interface MultiMapDiff
public void clearChanges()
clearChanges
in interface MultiMapDiff
public java.lang.Object clone()
clone
in class java.util.AbstractMap
protected 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 |