Interface CompositeMap.MapMutator<K,V>
- Type Parameters:
K- the type of the keys in the mapV- the type of the values in the map
- All Superinterfaces:
Serializable
- Enclosing class:
CompositeMap<K,V>
This interface allows definition for all of the indeterminate
mutators in a CompositeMap, as well as providing a hook for
callbacks on key collisions.
- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionCalled when the CompositeMap.put() method is invoked.voidCalled when the CompositeMap.putAll() method is invoked.voidresolveCollision(CompositeMap<K, V> composite, Map<K, V> existing, Map<K, V> added, Collection<K> intersect) Called when adding a new Composited Map results in a key collision.
-
Method Details
-
put
Called when the CompositeMap.put() method is invoked.- Parameters:
map- the CompositeMap which is being modifiedcomposited- array of Maps in the CompositeMap being modifiedkey- key with which the specified value is to be associated.value- value to be associated with the specified key.- Returns:
- previous value associated with specified key, or
nullif there was no mapping for key. Anullreturn can also indicate that the map previously associatednullwith the specified key, if the implementation supportsnullvalues. - Throws:
UnsupportedOperationException- if not definedClassCastException- if the class of the specified key or value prevents it from being stored in this map.IllegalArgumentException- if some aspect of this key or value prevents it from being stored in this map.NullPointerException- this map does not permitnullkeys or values, and the specified key or value isnull.
-
putAll
Called when the CompositeMap.putAll() method is invoked.- Parameters:
map- the CompositeMap which is being modifiedcomposited- array of Maps in the CompositeMap being modifiedmapToAdd- Mappings to be stored in this CompositeMap- Throws:
UnsupportedOperationException- if not definedClassCastException- if the class of the specified key or value prevents it from being stored in this map.IllegalArgumentException- if some aspect of this key or value prevents it from being stored in this map.NullPointerException- this map does not permitnullkeys or values, and the specified key or value isnull.
-
resolveCollision
void resolveCollision(CompositeMap<K, V> composite, Map<K, V> existing, Map<K, V> added, Collection<K> intersect) Called when adding a new Composited Map results in a key collision.- Parameters:
composite- the CompositeMap with the collisionexisting- the Map already in the composite which contains the offending keyadded- the Map being addedintersect- the intersection of the keysets of the existing and added maps
-