net.sf.saffron.util
Class MultiMap
java.lang.Object
|
+--java.util.AbstractMap
|
+--java.util.HashMap
|
+--net.sf.saffron.util.MultiMap
- All Implemented Interfaces:
- Cloneable, Map, Serializable
- public class MultiMap
- extends HashMap
Map which contains more than one value per key.
You can either use a MultiMap
as a regular map, or you can use
the additional methods putMulti(java.lang.Object, java.lang.Object)
and getMulti(java.lang.Object)
. Values are
returned in the order in which they were added.
- Since:
- May 18, 2003
- Version:
- $Id: //open/saffron/src/net/sf/saffron/util/MultiMap.java#2 $
- Author:
- jhyde
- See Also:
- Serialized Form
Nested Class Summary |
private static class |
MultiMap.ValueList
Holder class, ensures that user's values are never interpreted as
multiple values. |
Fields inherited from class java.util.HashMap |
|
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
MultiMap
public MultiMap()
getMulti
public List getMulti(Object key)
- Returns a list of values for a given key; returns an empty list if not
found.
- Post-condition:
- return != null
putMulti
public void putMulti(Object key,
Object value)
- Adds a value for this key.