org.apache.commons.collections
Class MultiHashMap

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

public class MultiHashMap
extends java.util.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(java.util.Map mapToCopy)
           
 
Method Summary
 void clear()
           
 java.lang.Object clone()
           
 boolean containsValue(java.lang.Object value)
           
 java.lang.String getName()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map mapToPut)
           
 java.lang.Object remove(java.lang.Object key, java.lang.Object item)
           
 java.util.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
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(java.util.Map mapToCopy)
Method Detail

getName

public java.lang.String getName()

put

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

containsValue

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

remove

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

clear

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

putAll

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

values

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

clone

public java.lang.Object clone()
Overrides:
clone in class java.util.HashMap


Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.