A MultiValueMap decorates another map, allowing it to have more than one value for a key.
A MultiMap
is a Map with slightly different semantics. Putting a value into the map will add the value to a Collection at that key. Getting a value will return a Collection, holding all the values put to that key.
This implementation is a decorator, allowing any Map implementation to be used as the base.
In addition, this implementation allows the type of collection used for the values to be controlled. By default, an ArrayList
is used, however a Class
to instantiate may be specified, or a factory that returns a Collection
instance.
Note that MultiValueMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization. This class may throw exceptions when accessed by concurrent threads without synchronization.
@since 3.2
@version $Id: MultiValueMap.java 1479407 2013-05-05 22:07:53Z tn $