Class TransformedMultiValuedMap<K,V> 
- Type Parameters:
- K- the type of the keys in this map
- V- the type of the values in this map
- All Implemented Interfaces:
- Serializable,- MultiValuedMap<K,- V> 
MultiValuedMap to transform objects that are added.
 This class affects the MultiValuedMap put methods. Thus objects must be removed or searched for using their transformed form. For example, if the transformation converts Strings to Integers, you must use the Integer form to remove objects.
Note that TransformedMultiValuedMap is not synchronized and is not thread-safe.
- Since:
- 4.1
- See Also:
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedTransformedMultiValuedMap(MultiValuedMap<K, V> map, Transformer<? super K, ? extends K> keyTransformer, Transformer<? super V, ? extends V> valueTransformer) Constructor that wraps (not copies).
- 
Method SummaryModifier and TypeMethodDescriptionbooleanAdds a key-value mapping to this multivalued map.booleanCopies all mappings from the specified map to this multivalued map (optional operation).booleanAdds a mapping to the specified key for all values contained in the given Iterable.booleanputAll(MultiValuedMap<? extends K, ? extends V> map) Copies all mappings from the specified map to this multivalued map (optional operation).static <K,V> TransformedMultiValuedMap <K, V> transformedMap(MultiValuedMap<K, V> map, Transformer<? super K, ? extends K> keyTransformer, Transformer<? super V, ? extends V> valueTransformer) Factory method to create a transforming MultiValuedMap that will transform existing contents of the specified map.static <K,V> TransformedMultiValuedMap <K, V> transformingMap(MultiValuedMap<K, V> map, Transformer<? super K, ? extends K> keyTransformer, Transformer<? super V, ? extends V> valueTransformer) Factory method to create a transforming MultiValuedMap.protected KtransformKey(K object) Transforms a key.protected VtransformValue(V object) Transforms a value.Methods inherited from class org.apache.commons.collections4.multimap.AbstractMultiValuedMapDecoratorasMap, clear, containsKey, containsMapping, containsValue, decorated, entries, equals, get, hashCode, isEmpty, keys, keySet, mapIterator, remove, removeMapping, size, toString, values
- 
Constructor Details- 
TransformedMultiValuedMapprotected TransformedMultiValuedMap(MultiValuedMap<K, V> map, Transformer<? super K, ? extends K> keyTransformer, Transformer<? super V, ? extends V> valueTransformer) Constructor that wraps (not copies).If there are any elements already in the collection being decorated, they are NOT transformed. - Parameters:
- map- the MultiValuedMap to decorate, may not be null
- keyTransformer- the transformer to use for key conversion, null means no conversion
- valueTransformer- the transformer to use for value conversion, null means no conversion
- Throws:
- NullPointerException- if map is null
 
 
- 
- 
Method Details- 
transformedMappublic static <K,V> TransformedMultiValuedMap<K,V> transformedMap(MultiValuedMap<K, V> map, Transformer<? super K, ? extends K> keyTransformer, Transformer<? super V, ? extends V> valueTransformer) Factory method to create a transforming MultiValuedMap that will transform existing contents of the specified map.If there are any elements already in the map being decorated, they will be transformed by this method. Contrast this with transformingMap(MultiValuedMap, Transformer, Transformer).- Type Parameters:
- K- the key type
- V- the value type
- Parameters:
- map- the MultiValuedMap to decorate, may not be null
- keyTransformer- the transformer to use for key conversion, null means no conversion
- valueTransformer- the transformer to use for value conversion, null means no conversion
- Returns:
- a new transformed MultiValuedMap
- Throws:
- NullPointerException- if map is null
 
- 
transformingMappublic static <K,V> TransformedMultiValuedMap<K,V> transformingMap(MultiValuedMap<K, V> map, Transformer<? super K, ? extends K> keyTransformer, Transformer<? super V, ? extends V> valueTransformer) Factory method to create a transforming MultiValuedMap.If there are any elements already in the map being decorated, they are NOT transformed. Contrast this with transformedMap(MultiValuedMap, Transformer, Transformer).- Type Parameters:
- K- the key type
- V- the value type
- Parameters:
- map- the MultiValuedMap to decorate, may not be null
- keyTransformer- the transformer to use for key conversion, null means no conversion
- valueTransformer- the transformer to use for value conversion, null means no conversion
- Returns:
- a new transformed MultiValuedMap
- Throws:
- NullPointerException- if map is null
 
- 
putDescription copied from interface:MultiValuedMapAdds a key-value mapping to this multivalued map.Unlike a normal Mapthe previous value is not replaced. Instead, the new value is added to the collection stored against the key. Depending on the collection type used, duplicate key-value mappings may be allowed.The method will return trueif the size of the multivalued map has been increased because of this operation.- Specified by:
- putin interface- MultiValuedMap<K,- V> 
- Overrides:
- putin class- AbstractMultiValuedMapDecorator<K,- V> 
- Parameters:
- key- the key to store against
- value- the value to add to the collection at the key
- Returns:
- true if the map changed as a result of this put operation, or false if the map already contained the key-value mapping and the collection type does not allow duplicate values, for example when using a Set
 
- 
putAllDescription copied from interface:MultiValuedMapAdds a mapping to the specified key for all values contained in the given Iterable.- Specified by:
- putAllin interface- MultiValuedMap<K,- V> 
- Overrides:
- putAllin class- AbstractMultiValuedMapDecorator<K,- V> 
- Parameters:
- key- the key to store against
- values- the values to add to the collection at the key, may not be null
- Returns:
- true if the map changed as a result of this operation
 
- 
putAllDescription copied from interface:MultiValuedMapCopies all mappings from the specified map to this multivalued map (optional operation).The effect of this call is equivalent to that of calling put(k, v)on this map once for each mapping from keykto valuevin the specified map.The behavior of this operation is undefined if the specified map is modified while the operation is in progress. - Specified by:
- putAllin interface- MultiValuedMap<K,- V> 
- Overrides:
- putAllin class- AbstractMultiValuedMapDecorator<K,- V> 
- Parameters:
- map- mappings to be stored in this map, may not be null
- Returns:
- true if the map changed as a result of this operation
 
- 
putAllDescription copied from interface:MultiValuedMapCopies all mappings from the specified map to this multivalued map (optional operation).The effect of this call is equivalent to that of calling put(k, v)on this map once for each mapping from keykto valuevin the specified map.The behavior of this operation is undefined if the specified map is modified while the operation is in progress. - Specified by:
- putAllin interface- MultiValuedMap<K,- V> 
- Overrides:
- putAllin class- AbstractMultiValuedMapDecorator<K,- V> 
- Parameters:
- map- mappings to be stored in this map, may not be null
- Returns:
- true if the map changed as a result of this operation
 
- 
transformKeyTransforms a key.The transformer itself may throw an exception if necessary. - Parameters:
- object- the object to transform
- Returns:
- the transformed object
 
- 
transformValueTransforms a value.The transformer itself may throw an exception if necessary. - Parameters:
- object- the object to transform
- Returns:
- the transformed object
 
 
-