⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections

Interface MultiMap

All Superinterfaces:
Map


public interface MultiMap
implements 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
Authors:
Christopher Berry
James Strachan
Stephen Colebourne

Method Summary

Object

remove(Object key, Object item)

Removes a specific value from map.

Method Details

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)