textbender.g.util
Class MultiMapRM<K,V>
java.lang.Object
MultiMapRM<K,V>
- All Implemented Interfaces:
- MultiMap<K,V>
@ThreadRestricted(value="per java.util.HashMap")
public final class MultiMapRM<K,V>
- extends Object
- implements MultiMap<K,V>
A multi-map optimized for the case of rare multiples.
For each extra value put to a key (beyond one),
a larger array is created to accommodate it.
Constructor Summary |
MultiMapRM()
Creates a MultiMapRM, with default initial capacity etc. per java.util.HashMap. |
Method Summary |
Object |
get(Object key)
Returns the values for the specified key. |
void |
put(K key,
V value)
Adds a value for the specified key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiMapRM
public MultiMapRM()
- Creates a MultiMapRM, with default initial capacity etc. per java.util.HashMap.
get
public Object get(Object key)
- Description copied from interface:
MultiMap
- Returns the values for the specified key.
If there are multiple values, they are returned in put-order.
- Specified by:
get
in interface MultiMap<K,V>
- Returns:
- either an array Object[] (multiple values);
a non-array Object (single value); or null (no value).
put
public void put(K key,
V value)
- Description copied from interface:
MultiMap
- Adds a value for the specified key.
- Specified by:
put
in interface MultiMap<K,V>
- Throws:
NullPointerException
- if value is null