cc.mallet.grmm.util
Class THashMultiMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by cc.mallet.grmm.util.THashMultiMap
All Implemented Interfaces:
java.util.Map

public class THashMultiMap
extends java.util.AbstractMap

Version of THashMap where every key is mapped to a list of objects.

The put method adds a value to the list associated with a key, without removing any previous values. The get method returns the list of all objects associated with key. No effort is made to remove duplicates. Created: Dec 13, 2005

Version:
$Id: THashMultiMap.java,v 1.1 2007/10/22 21:37:58 mccallum Exp $
Author:
Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
THashMultiMap()
           
THashMultiMap(int initialCapacity)
           
 
Method Summary
 void add(java.lang.Object key)
          Adds key as a key with an empty list as a value.
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object o)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Adds value to the list of things mapped to by key.
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

THashMultiMap

public THashMultiMap()

THashMultiMap

public THashMultiMap(int initialCapacity)
Method Detail

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
Specified by:
entrySet in class java.util.AbstractMap

add

public void add(java.lang.Object key)
Adds key as a key with an empty list as a value.


get

public java.lang.Object get(java.lang.Object o)
Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.AbstractMap

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Adds value to the list of things mapped to by key.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.AbstractMap
Returns:
The current list of values associated with key. (N.B. This deviates from Map contract slightly! (Hopefully harmlessly))