| java.lang.Object org.jfree.util.HashNMap
HashNMap | public class HashNMap implements Serializable,Cloneable(Code) | | The HashNMap can be used to store multiple values by a single key value. The
values stored can be retrieved using a direct query or by creating an
enumeration over the stored elements.
author: Thomas Morgner |
Constructor Summary | |
public | HashNMap() Default constructor. |
Method Summary | |
public boolean | add(Object key, Object val) Adds a new key/value pair into this map. | public void | clear() Clears all keys and values of this map. | public Object | clone() Creates a deep copy of this HashNMap. | public boolean | contains(Object value) Tests whether this map contains the given key or value.
Parameters: value - the value. | public boolean | containsKey(Object key) Tests whether this map contains the given key.
Parameters: key - the key. | public boolean | containsValue(Object value) Tests whether this map contains the given value.
Parameters: value - the value. | public boolean | containsValue(Object key, Object value) Tests whether this map contains the given value. | protected List | createList() Returns a new empty list. | public Object | get(Object key, int n) Retrieves the n-th value registered for an key or null if there was no
such key in the list. | public Iterator | getAll(Object key) Returns an iterator over all elements registered to the given key.
Parameters: key - the key. | public Object | getFirst(Object key) Retrieves the first value registered for an key or null if there was no
such key in the list.
Parameters: key - the key. | public int | getValueCount(Object key) Returns the number of elements registered with the given key.
Parameters: key - the key. | public Set | keySet() Returns all registered keys as set. | public Iterator | keys() Returns all registered keys as an enumeration. | public boolean | put(Object key, Object val) Inserts a new key/value pair into the map. | public boolean | remove(Object key, Object value) Removes the key/value pair from the map. | public void | removeAll(Object key) Removes all elements for the given key. | public Object[] | toArray(Object key, Object[] data) Returns the contents for the given key as object array. | public Object[] | toArray(Object key) Returns the contents for the given key as object array. |
HashNMap | public HashNMap()(Code) | | Default constructor.
|
add | public boolean add(Object key, Object val)(Code) | | Adds a new key/value pair into this map. If the key is not yet in the
map, it gets added to the map and the call is equal to
put(Object,Object).
Parameters: key - the key. Parameters: val - the value. true, if the value has been added, false otherwise |
clear | public void clear()(Code) | | Clears all keys and values of this map.
|
contains | public boolean contains(Object value)(Code) | | Tests whether this map contains the given key or value.
Parameters: value - the value. true if the key or value is contained in the map |
containsKey | public boolean containsKey(Object key)(Code) | | Tests whether this map contains the given key.
Parameters: key - the key. true if the key is contained in the map |
containsValue | public boolean containsValue(Object value)(Code) | | Tests whether this map contains the given value.
Parameters: value - the value. true if the value is registered in the map for an key. |
containsValue | public boolean containsValue(Object key, Object value)(Code) | | Tests whether this map contains the given value.
Parameters: value - the value. Parameters: key - the key under which to find the value true if the value is registered in the map for an key. |
createList | protected List createList()(Code) | | Returns a new empty list.
A new empty list. |
get | public Object get(Object key, int n)(Code) | | Retrieves the n-th value registered for an key or null if there was no
such key in the list. An index out of bounds exception is thrown if
there are less than n elements registered to this key.
Parameters: key - the key. Parameters: n - the index. the object. |
getAll | public Iterator getAll(Object key)(Code) | | Returns an iterator over all elements registered to the given key.
Parameters: key - the key. an iterator. |
getFirst | public Object getFirst(Object key)(Code) | | Retrieves the first value registered for an key or null if there was no
such key in the list.
Parameters: key - the key. the value. |
getValueCount | public int getValueCount(Object key)(Code) | | Returns the number of elements registered with the given key.
Parameters: key - the key. the number of element for this key, or 0 if there are no elementsregistered. |
keySet | public Set keySet()(Code) | | Returns all registered keys as set.
a set of keys. |
keys | public Iterator keys()(Code) | | Returns all registered keys as an enumeration.
an enumeration of the keys. |
put | public boolean put(Object key, Object val)(Code) | | Inserts a new key/value pair into the map. If such a pair already
exists, it gets replaced with the given values.
Parameters: key - the key. Parameters: val - the value. A boolean. |
remove | public boolean remove(Object key, Object value)(Code) | | Removes the key/value pair from the map. If the removed entry was the
last entry for this key, the key gets also removed.
Parameters: key - the key. Parameters: value - the value. true, if removing the element was successfull, false otherwise. |
removeAll | public void removeAll(Object key)(Code) | | Removes all elements for the given key.
Parameters: key - the key. |
toArray | public Object[] toArray(Object key, Object[] data)(Code) | | Returns the contents for the given key as object array. If there were
no objects registered with that key, an empty object array is returned.
Parameters: key - the key. Parameters: data - the object array to receive the contents. the contents. |
toArray | public Object[] toArray(Object key)(Code) | | Returns the contents for the given key as object array. If there were
no objects registered with that key, an empty object array is returned.
Parameters: key - the key. the contents. |
|
|