org.apache.commons.collections
Interface MultiMap

All Superinterfaces:
Map
All Known Implementing Classes:
MultiHashMap

public interface MultiMap
extends Map

Defines a map that holds a collection of values against each key.

A MultiMap is a Map with slightly different semantics. Putting a value into the map will add the value to a Collection at that key. Getting a value will always return a Collection, holding all the values put to that key. This implementation uses an ArrayList as the collection.

For example:

 MultiMap mhm = new MultiHashMap();
 mhm.put(key, "A");
 mhm.put(key, "B");
 mhm.put(key, "C");
 Collection coll = (Collection) mhm.get(key);

coll will be a list containing "A", "B", "C".

Since:
Commons Collections 2.0
Version:
$Revision: 1.10 $ $Date: 2004/01/14 21:43:04 $
Author:
Christopher Berry, James Strachan, Stephen Colebourne

Inner classes inherited from class java.util.Map
Map.Entry
 
Method Summary
 Object remove(Object key, Object item)
          Removes a specific value from map.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

remove

public Object remove(Object key,
                     Object item)
Removes a specific value from map.

The item is removed from the collection mapped to the specified key.

Parameters:
key - the key to remove from
item - the item to remove
Returns:
the value removed (which was passed in)


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