Top Description Inners Fields Constructors Methods
org.hsqldb.lib

public Class MultiValueHashMap<K, V>

extends BaseHashMap
implements Map<K, V>
Class Inheritance
All Implemented Interfaces
org.hsqldb.lib.Map
Imports
org.hsqldb.map.BaseHashMap

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.

Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.9.0
Version
2.7.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
private class
private class

Field Summary

Modifier and TypeField and Description
private Set<Map.Entry<K, V>>
private Set<K>
private Collection<V>
Inherited from org.hsqldb.map.BaseHashMap:
ACCESS_MAXaccessCountaccessMinaccessTablecomparatoremptyObjectArrayhashIndexhasZeroKeyinitialCapacityintKeyOrValueintKeyTableintValueTableisAccessCountisIntKeyisIntValueisLastAccessCountisListisLongKeyisLongValueisMultiValueisNoValueisObjectKeyisObjectValueloadFactorlongKeyOrValuelongKeyTablelongValueTablemaxCapacityminimizeOnEmptyNO_PURGEnoKeyOrValueobjectKeyOrValueobjectKeyTableobjectValueTableobjectValueTable2objectValueTable3PURGE_ALLPURGE_HALFpurgePolicythresholdzeroKeyIndexzeroOrNullValueCount

Constructor Summary

AccessConstructor and Description
public
public
MultiValueHashMap(int initialCapacity)

public
MultiValueHashMap(int initialCapacity, ObjectComparator<K> comparator)

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public Set<Map.Entry<K, V>>
public V

Returns:

any value associated with the key, or null if none
get
(K
the key
key
)

Implements org.hsqldb.lib.Map.get.

Returns one of the values associated with the given key.

public Iterator<V>

Returns:

iterator on value associated with the key
getValuesIterator
(Object
the key
key
)

Returns an iterator on all values associated with the key.

public Set<K>
public <T> T[]
keysToArray(T[] array)

public V
put(K key, V value)

Implements org.hsqldb.lib.Map.put.

public void
putAll(Map<K, V> m)

public void
public V

Returns:

any value associated with the key, or null if none
remove
(Object
the key
key
)

Implements org.hsqldb.lib.Map.remove.

Removes all values associated with the key.

public boolean

Returns:

the value associated with the key, or null if none
remove
(K
the key
key
,
V
the value
value
)

Removes the spacific value associated with the key.

public int

Returns:

the count
valueCount
(K
the key
key
)

Counts the values associated with the key.

public Collection<V>
public <T> T[]
valuesToArray(T[] array)

Inherited from org.hsqldb.map.BaseHashMap:
addMultiValaddOrRemoveObjectaddOrUpdatecapacityclearclonecontainsIntKeycontainsLongKeycontainsObjectKeycontainsValuecontainsValuegetAccessCountCeilinggetLookupgetLookupgetLookupgetLookupgetMultiValuesIteratorgetObjectLookupinsertRowisEmptymultiValueElementCountmultiValueKeyCountmultiValueKeysToArraynextLookuprehashremoveremoveMultiValremoveObjectremoveRowresetresetAccessCountsetAccessCountFloorsizetoArraytoArraytoIntArraytoLongArray

Field Detail

entriesback to summary
private Set<Map.Entry<K, V>> entries
keySetback to summary
private Set<K> keySet
valuesback to summary
private Collection<V> values

Constructor Detail

MultiValueHashMapback to summary
public MultiValueHashMap()
MultiValueHashMapback to summary
public MultiValueHashMap(int initialCapacity) throws IllegalArgumentException
MultiValueHashMapback to summary
public MultiValueHashMap(int initialCapacity, ObjectComparator<K> comparator) throws IllegalArgumentException

Method Detail

containsKeyback to summary
public boolean containsKey(Object key)

Implements org.hsqldb.lib.Map.containsKey.

containsValueback to summary
public boolean containsValue(Object value)

Overrides org.hsqldb.map.BaseHashMap.containsValue.

Implements org.hsqldb.lib.Map.containsValue.

entrySetback to summary
public Set<Map.Entry<K, V>> entrySet()

Implements org.hsqldb.lib.Map.entrySet.

getback to summary
public V get(K key)

Implements org.hsqldb.lib.Map.get.

Returns one of the values associated with the given key.

Parameters
key:K

the key

Returns:V

any value associated with the key, or null if none

getValuesIteratorback to summary
public Iterator<V> getValuesIterator(Object key)

Returns an iterator on all values associated with the key.

Parameters
key:Object

the key

Returns:Iterator<V>

iterator on value associated with the key

keySetback to summary
public Set<K> keySet()

Implements org.hsqldb.lib.Map.keySet.

keysToArrayback to summary
public <T> T[] keysToArray(T[] array)
putback to summary
public V put(K key, V value)

Implements org.hsqldb.lib.Map.put.

putAllback to summary
public void putAll(Map<K, V> m)
putAllback to summary
public void putAll(MultiValueHashMap<K, V> m)
removeback to summary
public V remove(Object key)

Implements org.hsqldb.lib.Map.remove.

Removes all values associated with the key.

Parameters
key:Object

the key

Returns:V

any value associated with the key, or null if none

removeback to summary
public boolean remove(K key, V value)

Removes the spacific value associated with the key.

Parameters
key:K

the key

value:V

the value

Returns:boolean

the value associated with the key, or null if none

valueCountback to summary
public int valueCount(K key)

Counts the values associated with the key.

Parameters
key:K

the key

Returns:int

the count

valuesback to summary
public Collection<V> values()

Implements org.hsqldb.lib.Map.values.

valuesToArrayback to summary
public <T> T[] valuesToArray(T[] array)
org.hsqldb.lib back to summary

private Class MultiValueHashMap.EntrySet

extends AbstractReadOnlyCollection<Map.Entry<K, V>>
implements Set<Map.Entry<K, V>>
Class Inheritance
All Implemented Interfaces
org.hsqldb.lib.Set, org.hsqldb.lib.Collection

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public Iterator<Map.Entry<K, V>>
public int
Inherited from org.hsqldb.lib.AbstractReadOnlyCollection:
addaddAllclearcontainsremove

Constructor Detail

EntrySetback to summary
private EntrySet()

Method Detail

isEmptyback to summary
public boolean isEmpty()

Implements org.hsqldb.lib.Collection.isEmpty.

iteratorback to summary
public Iterator<Map.Entry<K, V>> iterator()

Implements org.hsqldb.lib.Collection.iterator.

sizeback to summary
public int size()

Implements org.hsqldb.lib.Collection.size.

org.hsqldb.lib back to summary

private Class MultiValueHashMap.EntrySetIterator<K, V>

extends BaseHashIterator
Class Inheritance

Field Summary

Inherited from org.hsqldb.map.BaseHashMap.BaseHashIterator:
counterkeyslookupremoved

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Map.Entry<K, V>
Inherited from org.hsqldb.map.BaseHashMap.BaseHashIterator:
getAccessCountgetLookuphasNextnextIntnextLongremoveresetsetAccessCount

Constructor Detail

EntrySetIteratorback to summary
pack-priv EntrySetIterator()

Method Detail

nextback to summary
public Map.Entry<K, V> next()

Overrides org.hsqldb.map.BaseHashMap.BaseHashIterator.next.

Implements org.hsqldb.lib.Iterator.next.

org.hsqldb.lib back to summary

private Class MultiValueHashMap.KeySet

extends AbstractReadOnlyCollection<K>
implements Set<K>
Class Inheritance
All Implemented Interfaces
org.hsqldb.lib.Set, org.hsqldb.lib.Collection

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public Iterator<K>
public int
Inherited from org.hsqldb.lib.AbstractReadOnlyCollection:
addaddAllclearcontainsremove

Constructor Detail

KeySetback to summary
private KeySet()

Method Detail

isEmptyback to summary
public boolean isEmpty()

Implements org.hsqldb.lib.Collection.isEmpty.

iteratorback to summary
public Iterator<K> iterator()

Implements org.hsqldb.lib.Collection.iterator.

sizeback to summary
public int size()

Implements org.hsqldb.lib.Collection.size.

org.hsqldb.lib back to summary

private Class MultiValueHashMap.Values

extends AbstractReadOnlyCollection<V>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public Iterator<V>
public int
Inherited from org.hsqldb.lib.AbstractReadOnlyCollection:
addaddAllclearcontainsremove

Constructor Detail

Valuesback to summary
private Values()

Method Detail

isEmptyback to summary
public boolean isEmpty()

Implements org.hsqldb.lib.Collection.isEmpty.

iteratorback to summary
public Iterator<V> iterator()

Implements org.hsqldb.lib.Collection.iterator.

sizeback to summary
public int size()

Implements org.hsqldb.lib.Collection.size.