MultiHashMap is the default implementation of the {@link org.apache.commons.collections.MultiMap MultiMap} interface. 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 uses an ArrayList as the collection. The internal storage list is made available without cloning via the get(Object) and entrySet() methods. The implementation returns null when there are no values mapped to a key.
For example:
MultiMap mhm = new MultiHashMap(); mhm.put(key, "A"); mhm.put(key, "B"); mhm.put(key, "C"); List list = (List) mhm.get(key);
list will be a list containing "A", "B", "C".
@since Commons Collections 2.0
@version $Revision: 1.20 $ $Date: 2004/06/09 22:11:54 $
@author Christopher Berry
@author James Strachan
@author Steve Downey
@author Stephen Colebourne
@author Julien Buret
@author Serhiy Yevtushenko
| |
| |
| |
| |