Class HashSetValuedHashMap<K,V>
java.lang.Object
org.apache.commons.collections4.multimap.AbstractMultiValuedMap<K,V>
org.apache.commons.collections4.multimap.AbstractSetValuedMap<K,V>
org.apache.commons.collections4.multimap.HashSetValuedHashMap<K,V>
- Type Parameters:
K- the type of the keys in this mapV- the type of the values in this map
- All Implemented Interfaces:
Serializable, MultiValuedMap<K,V>, SetValuedMap<K, V>
Implements a
SetValuedMap, using a HashMap to provide data
storage and HashSets as value collections. This is the standard
implementation of a SetValuedMap.
Note that HashSetValuedHashMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization. This class may throw exceptions when accessed by concurrent threads without synchronization.
- Since:
- 4.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMultiValuedMap
AbstractMultiValuedMap.WrappedCollection -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intThe initial map capacity used when none specified in constructor.private static final intThe initial set capacity when using none specified in constructor.private final intThe initial list capacity when creating a new value collection.private static final longSerialization Version -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty HashSetValuedHashMap with the default initial map capacity (16) and the default initial set capacity (3).HashSetValuedHashMap(int initialSetCapacity) Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the specified initial set capacity.HashSetValuedHashMap(int initialMapCapacity, int initialSetCapacity) Creates an empty HashSetValuedHashMap with the specified initial map and list capacities.HashSetValuedHashMap(Map<? extends K, ? extends V> map) Creates an HashSetValuedHashMap copying all the mappings of the given map.HashSetValuedHashMap(MultiValuedMap<? extends K, ? extends V> map) Creates an HashSetValuedHashMap copying all the mappings of the given map. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new value collection using the provided factory.private voidprivate voidMethods inherited from class AbstractSetValuedMap
get, getMap, remove, wrappedCollectionMethods inherited from class AbstractMultiValuedMap
asMap, clear, containsKey, containsMapping, containsValue, doReadObject, doWriteObject, entries, equals, hashCode, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, setMap, size, toString, valuesMethods inherited from interface MultiValuedMap
asMap, clear, containsKey, containsMapping, containsValue, entries, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, size, values
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization Version- See Also:
-
DEFAULT_INITIAL_MAP_CAPACITY
private static final int DEFAULT_INITIAL_MAP_CAPACITYThe initial map capacity used when none specified in constructor.- See Also:
-
DEFAULT_INITIAL_SET_CAPACITY
private static final int DEFAULT_INITIAL_SET_CAPACITYThe initial set capacity when using none specified in constructor.- See Also:
-
initialSetCapacity
private final int initialSetCapacityThe initial list capacity when creating a new value collection.
-
-
Constructor Details
-
HashSetValuedHashMap
public HashSetValuedHashMap()Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the default initial set capacity (3). -
HashSetValuedHashMap
public HashSetValuedHashMap(int initialSetCapacity) Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the specified initial set capacity.- Parameters:
initialSetCapacity- the initial capacity used for value collections
-
HashSetValuedHashMap
public HashSetValuedHashMap(int initialMapCapacity, int initialSetCapacity) Creates an empty HashSetValuedHashMap with the specified initial map and list capacities.- Parameters:
initialMapCapacity- the initial hashmap capacityinitialSetCapacity- the initial capacity used for value collections
-
HashSetValuedHashMap
Creates an HashSetValuedHashMap copying all the mappings of the given map.- Parameters:
map- aMultiValuedMapto copy into this map
-
HashSetValuedHashMap
-
-
Method Details
-
createCollection
Description copied from class:AbstractSetValuedMapCreates a new value collection using the provided factory.- Specified by:
createCollectionin classAbstractSetValuedMap<K,V> - Returns:
- a new list
-
writeObject
- Throws:
IOException
-
readObject
- Throws:
IOExceptionClassNotFoundException
-