forked from I2P_Developers/i2p.i2p
MultiMap: Cleanups, javadocs after review
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user