|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.util.MultiMap
public class MultiMap
Provides a one to many mapping between a key and some values.
Constructor Summary | ||
---|---|---|
MultiMap()
Constructs a new MultiMap instance. |
||
MultiMap(int initialHashtableCapacity,
int initialVectorCapacity)
Constructs a new MultiMap instance with the provided capacity. |
Method Summary | ||
---|---|---|
boolean |
add(Object key,
Object value)
Maps value to key. |
|
void |
clear()
Removes all keys and values. |
|
boolean |
containsKey(Object key)
Determines if key is mapped. |
|
boolean |
containsValue(Object key,
Object value)
Determines if value is mapped to key. |
|
Enumeration |
elements()
Retrieves an enumeration of the values in this map. |
|
Enumeration |
elements(Object key)
Retrieves an enumeration of values for a key. |
|
boolean |
isEmpty()
Determines if this map is empty. |
|
Enumeration |
keys()
Retrieves an enumeration of the keys in this map. |
|
boolean |
removeKey(Object key)
Removes values by key. |
|
boolean |
removeValue(Object value)
Removes value from map. |
|
boolean |
removeValue(Object key,
Object value)
Removes value by key from map. |
|
int |
size()
Retrieves the number of values in this map. |
|
int |
size(Object key)
Retrieves number of values associated with provided key. |
|
String |
toString()
Retrieves string representation of this map. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MultiMap(int initialHashtableCapacity, int initialVectorCapacity)
initialCapacity
- Starting capacity for this map.public MultiMap()
This method creates a new multi map with a default capacity.
Method Detail |
---|
public boolean isEmpty()
public void clear()
public boolean add(Object key, Object value)
This method does not checking on the key or value parameters: for safety, you should neither seed this map with null keys, nor null values for keys.
key
- Key to associate with value; if this key already exists in the
map, the provided value is added to its association list. Must not be null.value
- Value to associate with key. Must not be null.
public boolean removeKey(Object key)
key
- Key for value(s) to remove.
public boolean removeValue(Object key, Object value)
If the value to remove is the last one associated with the key, then this method removes the key as well. Otherwise, this method removes only the value from the map; the key and its associations with other values remains.
key
- Key associated with value.value
- Value to remove.
public boolean removeValue(Object value)
Invoke this method to remove a value from this map when you don't
know its associated key. If you do know the key associated with this
value, then you should invoke the more efficient
MultiMap.removeValue(Object,Object)
.
If the value to remove is the last one associated with its key, then this method removes the key as well. Otherwise, this method removes only the value from the map; the key and its associations with other values remains.
public boolean containsKey(Object key)
key
- Key to check.
public boolean containsValue(Object key, Object value)
key
- Key to check.value
- Value to check.
public Enumeration keys()
Enumeration
,
MultiMap.elements()
public Enumeration elements(Object key)
key
- Key associated with values.
Enumeration
public Enumeration elements()
Enumeration
,
MultiMap.keys()
public int size()
Note that this method provides the number of values associated with all keys in this map.
public int size(Object key)
key
- Key in question.
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal