org.apache.commons.collections
Class MultiHashMap

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--org.apache.commons.collections.MultiHashMap
All Implemented Interfaces:
Cloneable, Map, MultiMap, Serializable

public class MultiHashMap
extends HashMap
implements MultiMap

MultiHashMap is the default implementation of the MultiMap interface. A MultiMap is a Map with slightly different semantics. Instead of returning an Object, it returns a Collection. So for example, you can put( key, new Integer(1) ); and then a Object get( key ); will return you a Collection instead of an Integer.

Since:
2.0
Author:
Christopher Berry, James Strachan, Steve Downey, Stephen Colebourne
See Also:
Serialized Form

Constructor Summary
MultiHashMap()
           
MultiHashMap(int initialCapacity)
           
MultiHashMap(int initialCapacity, float loadFactor)
           
MultiHashMap(Map mapToCopy)
           
 
Method Summary
 void clear()
           
 Object clone()
           
 boolean containsValue(Object value)
           
 String getName()
           
 Object put(Object key, Object value)
           
 void putAll(Map mapToPut)
           
 Object remove(Object key, Object item)
           
 Collection values()
           
 
Methods inherited from class java.util.HashMap
containsKey, entrySet, get, isEmpty, keySet, remove, size
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, entrySet, equals, get, hashCode, isEmpty, keySet, remove, size
 

Constructor Detail

MultiHashMap

public MultiHashMap()

MultiHashMap

public MultiHashMap(int initialCapacity)

MultiHashMap

public MultiHashMap(int initialCapacity,
                    float loadFactor)

MultiHashMap

public MultiHashMap(Map mapToCopy)
Method Detail

clear

public void clear()
Specified by:
clear in interface Map
Overrides:
clear in class HashMap

clone

public Object clone()
Overrides:
clone in class HashMap

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map
Overrides:
containsValue in class HashMap

getName

public String getName()

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map
Overrides:
put in class HashMap

putAll

public void putAll(Map mapToPut)
Specified by:
putAll in interface Map
Overrides:
putAll in class HashMap

remove

public Object remove(Object key,
                     Object item)
Specified by:
remove in interface MultiMap

values

public Collection values()
Specified by:
values in interface Map
Overrides:
values in class HashMap


Copyright © 2001-2002 Apache Software Foundation. Documenation generated February 22 2003.