diff --git a/apps/susimail/src/src/org/mortbay/util/MultiMap.java b/apps/susimail/src/src/org/mortbay/util/MultiMap.java index 2a16cf520648d09eac33a21f60ed2f85ef4e7202..62bcbb7880191ba6d241484d1a5aaf66a9241308 100644 --- a/apps/susimail/src/src/org/mortbay/util/MultiMap.java +++ b/apps/susimail/src/src/org/mortbay/util/MultiMap.java @@ -5,13 +5,23 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; +/** + * A multi valued Map. + * Simple I2P replacement for org.eclipse.jetty.util.MultiMap + * so we don't depend on Jetty utils. + * + * Contains only the methods required by MultiPartRequest. + * Does not implement Map. Unsynchronized. + * + * @since 0.9.12 + */ public class MultiMap<T> { - HashMap<T, LinkedList<Object>> data; + private final HashMap<T, LinkedList<Object>> data; - public MultiMap(int i) + public MultiMap(int capacity) { - data = new HashMap<T, LinkedList<Object>>(); + data = new HashMap<T, LinkedList<Object>>(capacity); } public Set<T> keySet() @@ -19,6 +29,14 @@ public class MultiMap<T> return data.keySet(); } + /** + * This returns the first item or null. + * The Jetty version appears to return the item if only one, + * or the entire list if more than one. + * Only used by MultiPartRequest.contains() which is unused. + * contains() would fail with a ClassCastException if we returned a list here, + * which is a bug in MultiPartRequest? + */ public Object get(T key) { List<Object> tmp = getValues(key);