java.lang.Object
org.hsqldb.map.BaseHashMap
org.hsqldb.lib.MultiValueHashMap<K,V>
- All Implemented Interfaces:
Map<K,
V>
A Map of Object keys to Object values which stores multiple values per
key. The getValuesIterator(K key) method returns an iterator covering the
values associated with the given key. The get(K key) method returns the first
value (if any) associated with the key.
This class does not store null keys.
- Since:
- 1.9.0
- Author:
- Fred Toussi (fredt@users dot sourceforge.net)
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.hsqldb.map.BaseHashMap
ACCESS_MAX, emptyObjectArray
-
Constructor Summary
ConstructorsConstructorDescriptionMultiValueHashMap
(int initialCapacity) MultiValueHashMap
(int initialCapacity, ObjectComparator comparator) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
Returns one of the values associated with the given key.getValuesIterator
(Object key) Returns an iterator on all values associated with the key.keySet()
<T> T[]
keysToArray
(T[] array) void
void
putAll
(MultiValueHashMap<K, V> m) Removes all values associated with the key.boolean
Removes the spacific value associated with the key.int
valueCount
(Object key) Counts the values associated with the key.values()
<T> T[]
valuesToArray
(T[] array) Methods inherited from class org.hsqldb.map.BaseHashMap
clear, clone, isEmpty, size
-
Constructor Details
-
MultiValueHashMap
public MultiValueHashMap() -
MultiValueHashMap
- Throws:
IllegalArgumentException
-
MultiValueHashMap
public MultiValueHashMap(int initialCapacity, ObjectComparator comparator) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
-
Method Details
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
get
Returns one of the values associated with the given key. -
getValuesIterator
Returns an iterator on all values associated with the key.- Parameters:
key
- the key- Returns:
- iterator on value associated with the key
-
put
-
remove
Removes all values associated with the key. -
remove
Removes the spacific value associated with the key.- Parameters:
key
- the keyvalue
- the value- Returns:
- the value associated with the key, or null if none
-
valueCount
Counts the values associated with the key.- Parameters:
key
- the key- Returns:
- the count
-
putAll
-
putAll
-
keysToArray
public <T> T[] keysToArray(T[] array) -
valuesToArray
public <T> T[] valuesToArray(T[] array) -
keySet
-
values
-
entrySet
-