de.lmu.ifi.dbs.elki.utilities.datastructures
Class HashMapList<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,List<V>>
          extended by de.lmu.ifi.dbs.elki.utilities.datastructures.HashMapList<K,V>
Type Parameters:
K - Key type
V - Value type
All Implemented Interfaces:
Serializable, Cloneable, Map<K,List<V>>

public class HashMapList<K,V>
extends HashMap<K,List<V>>

Multi-Associative container, that stores a list of values for a particular key.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
private static long serialVersionUID
          Serial version
 
Constructor Summary
HashMapList()
          Constructor.
HashMapList(int initialCapacity)
          Constructor with initial capacity (of the hash)
 
Method Summary
 void add(K key, V value)
          Add a single value to the given key.
 boolean contains(K key, V value)
          Test if a given value is already present for the key.
 boolean containsKey(Object key)
          Check that there is at least one value for the key.
 boolean remove(K key, V value)
          Remove a single value from the map.
 
Methods inherited from class java.util.HashMap
clear, clone, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version

See Also:
Constant Field Values
Constructor Detail

HashMapList

public HashMapList()
Constructor.


HashMapList

public HashMapList(int initialCapacity)
Constructor with initial capacity (of the hash)

Parameters:
initialCapacity - initial capacity
Method Detail

add

public void add(K key,
                V value)
Add a single value to the given key.

Parameters:
key - Key
value - Additional Value

containsKey

public boolean containsKey(Object key)
Check that there is at least one value for the key.

Specified by:
containsKey in interface Map<K,List<V>>
Overrides:
containsKey in class HashMap<K,List<V>>

remove

public boolean remove(K key,
                      V value)
Remove a single value from the map.

Parameters:
key - Key to remove
value - Value to remove.
Returns:
true if this list contained the specified element

contains

public boolean contains(K key,
                        V value)
Test if a given value is already present for the key.

Parameters:
key - Key
value - Value
Returns:
true if the keys list contains the specified element

Release 0.4.0 (2011-09-20_1324)