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