textbender.g.util
Class MultiMapRM<K,V>

java.lang.Object
  extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface MultiMap
MultiMap.U, MultiMap.UnmodifiableMultiMap<K,V>
 
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
 

Constructor Detail

MultiMapRM

public MultiMapRM()
Creates a MultiMapRM, with default initial capacity etc. per java.util.HashMap.

Method Detail

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