I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit c68769cf authored by zzz's avatar zzz
Browse files

MultiMap: Cleanups, javadocs after review

parent 3e639a31
No related branches found
No related tags found
No related merge requests found
...@@ -5,13 +5,23 @@ import java.util.LinkedList; ...@@ -5,13 +5,23 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; 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> 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() public Set<T> keySet()
...@@ -19,6 +29,14 @@ public class MultiMap<T> ...@@ -19,6 +29,14 @@ public class MultiMap<T>
return data.keySet(); 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) public Object get(T key)
{ {
List<Object> tmp = getValues(key); List<Object> tmp = getValues(key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment