You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2002/11/24 20:33:19 UTC
cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections MultiMap.java
scolebourne 2002/11/24 11:33:19
Modified: collections/src/java/org/apache/commons/collections
MultiMap.java
Log:
Improve javadoc description of what a MultiMap is
Revision Changes Path
1.5 +30 -9 jakarta-commons/collections/src/java/org/apache/commons/collections/MultiMap.java
Index: MultiMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/MultiMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MultiMap.java 12 Jun 2002 03:59:15 -0000 1.4
+++ MultiMap.java 24 Nov 2002 19:33:19 -0000 1.5
@@ -64,18 +64,39 @@
/**
* This is simply 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.
- * Thus, this is simply a tag interface.
+ * <p>
+ * A <code>MultiMap</code> 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.
+ * <p>
+ * For example:
+ * <pre>
+ * MultiMap mhm = new MultiHashMap();
+ * mhm.put(key, "A");
+ * mhm.put(key, "B");
+ * mhm.put(key, "C");
+ * Collection coll = (Collection) mhm.get(key);</pre>
+ * <p>
+ * <code>coll</code> will be a list containing "A", "B", "C".
*
* @since 2.0
* @author Christopher Berry
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
+ * @author Stephen Colebourne
*/
public interface MultiMap extends Map {
- public Object remove( Object key, Object item );
+ /**
+ * Removes a specific value from map.
+ * <p>
+ * The item is removed from the collection mapped to the specified key.
+ *
+ * @param key the key to remove from
+ * @param value the value to remove
+ * @return the value removed (which was passed in)
+ */
+ public Object remove(Object key, Object item);
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>