public class HashNMap extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
Constructor and Description |
---|
HashNMap()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.Object key,
java.lang.Object val)
Adds a new key/value pair into this map.
|
void |
clear()
Clears all keys and values of this map.
|
java.lang.Object |
clone()
Creates a deep copy of this HashNMap.
|
boolean |
contains(java.lang.Object value)
Tests whether this map contains the given key or value.
|
boolean |
containsKey(java.lang.Object key)
Tests whether this map contains the given key.
|
boolean |
containsValue(java.lang.Object value)
Tests whether this map contains the given value.
|
boolean |
containsValue(java.lang.Object key,
java.lang.Object value)
Tests whether this map contains the given value.
|
protected java.util.List |
createList()
Returns a new empty list.
|
java.lang.Object |
get(java.lang.Object key,
int n)
Retrieves the n-th value registered for an key or null if there was no
such key in the list.
|
java.util.Iterator |
getAll(java.lang.Object key)
Returns an iterator over all elements registered to the given key.
|
java.lang.Object |
getFirst(java.lang.Object key)
Retrieves the first value registered for an key or null if there was no
such key in the list.
|
int |
getValueCount(java.lang.Object key)
Returns the number of elements registered with the given key.
|
java.util.Iterator |
keys()
Returns all registered keys as an enumeration.
|
java.util.Set |
keySet()
Returns all registered keys as set.
|
boolean |
put(java.lang.Object key,
java.lang.Object val)
Inserts a new key/value pair into the map.
|
boolean |
remove(java.lang.Object key,
java.lang.Object value)
Removes the key/value pair from the map.
|
void |
removeAll(java.lang.Object key)
Removes all elements for the given key.
|
java.lang.Object[] |
toArray(java.lang.Object key)
Returns the contents for the given key as object array.
|
java.lang.Object[] |
toArray(java.lang.Object key,
java.lang.Object[] data)
Returns the contents for the given key as object array.
|
public HashNMap()
protected java.util.List createList()
public boolean put(java.lang.Object key, java.lang.Object val)
key
- the key.val
- the value.public boolean add(java.lang.Object key, java.lang.Object val)
key
- the key.val
- the value.public java.lang.Object getFirst(java.lang.Object key)
key
- the key.public java.lang.Object get(java.lang.Object key, int n)
key
- the key.n
- the index.public java.util.Iterator getAll(java.lang.Object key)
key
- the key.public java.util.Iterator keys()
public java.util.Set keySet()
public boolean remove(java.lang.Object key, java.lang.Object value)
key
- the key.value
- the value.public void removeAll(java.lang.Object key)
key
- the key.public void clear()
public boolean containsKey(java.lang.Object key)
key
- the key.public boolean containsValue(java.lang.Object value)
value
- the value.public boolean containsValue(java.lang.Object key, java.lang.Object value)
value
- the value.key
- the key under which to find the valuepublic boolean contains(java.lang.Object value)
value
- the value.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- this should never happen.public java.lang.Object[] toArray(java.lang.Object key, java.lang.Object[] data)
key
- the key.data
- the object array to receive the contents.public java.lang.Object[] toArray(java.lang.Object key)
key
- the key.public int getValueCount(java.lang.Object key)
key
- the key.