de.lmu.ifi.dbs.elki.utilities
Class HashMapList<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,List<V>>
de.lmu.ifi.dbs.elki.utilities.HashMapList<K,V>
- Type Parameters:
K
- Key typeV
- 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.
- Author:
- Erich Schubert
- See Also:
- Serialized Form
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 |
serialVersionUID
private static final long serialVersionUID
- Serial version
- See Also:
- Constant Field Values
HashMapList
public HashMapList()
- Constructor.
HashMapList
public HashMapList(int initialCapacity)
- Constructor with initial capacity (of the hash)
- Parameters:
initialCapacity
-
add
public void add(K key,
V value)
- Add a single value to the given key.
- Parameters:
key
- Keyvalue
- 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 removevalue
- 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
- Keyvalue
- Value
- Returns:
- true if the keys list contains the specified element