| java.util.HashMap org.mortbay.util.MultiMap
All known Subclasses: org.mortbay.util.UrlEncoded,
MultiMap | public class MultiMap extends HashMap implements Cloneable(Code) | | A multi valued Map.
This Map specializes HashMap and provides methods
that operate on multi valued items.
Implemented as a map of LazyList values
See Also: LazyList author: Greg Wilkins (gregw) |
Method Summary | |
public void | add(Object name, Object value) Add value to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
Parameters: name - The entry key. | public void | addValues(Object name, List values) Add values to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
Parameters: name - The entry key. | public void | addValues(Object name, String[] values) Add values to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
Parameters: name - The entry key. | public Object | clone() | public Object | get(Object name) | public String | getString(Object name) Get value as String.
Single valued items are converted to a String with the toString()
Object method. | public Object | getValue(Object name, int i) Get a value from a multiple value.
If the value is not a multivalue, then index 0 retrieves the
value or null.
Parameters: name - The entry key. Parameters: i - Index of element to get. | public List | getValues(Object name) Get multiple values.
Single valued entries are converted to singleton lists.
Parameters: name - The entry key. | public Object | put(Object name, Object value) Put and entry into the map.
Parameters: name - The entry key. | public void | putAll(Map m) Put all contents of map. | public Object | putValues(Object name, List values) Put multi valued entry.
Parameters: name - The entry key. | public Object | putValues(Object name, String[] values) Put multi valued entry.
Parameters: name - The entry key. | public boolean | removeValue(Object name, Object value) Remove value.
Parameters: name - The entry key. | public Map | toStringArrayMap() |
MultiMap | public MultiMap()(Code) | | Constructor.
|
MultiMap | public MultiMap(int size)(Code) | | Constructor.
Parameters: size - Capacity of the map |
MultiMap | public MultiMap(Map map)(Code) | | Constructor.
Parameters: map - |
add | public void add(Object name, Object value)(Code) | | Add value to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
Parameters: name - The entry key. Parameters: value - The entry value. |
addValues | public void addValues(Object name, List values)(Code) | | Add values to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
Parameters: name - The entry key. Parameters: values - The List of multiple values. |
addValues | public void addValues(Object name, String[] values)(Code) | | Add values to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
Parameters: name - The entry key. Parameters: values - The String array of multiple values. |
getString | public String getString(Object name)(Code) | | Get value as String.
Single valued items are converted to a String with the toString()
Object method. Multi valued entries are converted to a comma separated
List. No quoting of commas within values is performed.
Parameters: name - The entry key. String value. |
getValue | public Object getValue(Object name, int i)(Code) | | Get a value from a multiple value.
If the value is not a multivalue, then index 0 retrieves the
value or null.
Parameters: name - The entry key. Parameters: i - Index of element to get. Unmodifieable List of values. |
getValues | public List getValues(Object name)(Code) | | Get multiple values.
Single valued entries are converted to singleton lists.
Parameters: name - The entry key. Unmodifieable List of values. |
put | public Object put(Object name, Object value)(Code) | | Put and entry into the map.
Parameters: name - The entry key. Parameters: value - The entry value. The previous value or null. |
putAll | public void putAll(Map m)(Code) | | Put all contents of map.
Parameters: m - Map |
putValues | public Object putValues(Object name, List values)(Code) | | Put multi valued entry.
Parameters: name - The entry key. Parameters: values - The List of multiple values. The previous value or null. |
putValues | public Object putValues(Object name, String[] values)(Code) | | Put multi valued entry.
Parameters: name - The entry key. Parameters: values - The String array of multiple values. The previous value or null. |
removeValue | public boolean removeValue(Object name, Object value)(Code) | | Remove value.
Parameters: name - The entry key. Parameters: value - The entry value. true if it was removed. |
toStringArrayMap | public Map toStringArrayMap()(Code) | | Map of String arrays |
|
|