Top Description Fields Constructors Methods
org.apache.commons.collections4.multimap

public Class HashSetValuedHashMap<K, V>

extends AbstractSetValuedMap<K, V>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Type Parameters
<K>
the type of the keys in this map
<V>
the type of the values in this map
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.HashMap, .HashSet, .Map, org.apache.commons.collections4.MultiValuedMap

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

Field Summary

Modifier and TypeField and Description
private static final int
DEFAULT_INITIAL_MAP_CAPACITY

The initial map capacity used when none specified in constructor.

private static final int
DEFAULT_INITIAL_SET_CAPACITY

The initial set capacity when using none specified in constructor.

private final int
initialSetCapacity

The initial list capacity when creating a new value collection.

private static final long
serialVersionUID

Serialization Version

Constructor Summary

AccessConstructor and Description
public
HashSetValuedHashMap()

Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the default initial set capacity (3).

public
HashSetValuedHashMap(final int
the initial capacity used for value collections
initialSetCapacity
)

Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the specified initial set capacity.

public
HashSetValuedHashMap(final int
the initial hashmap capacity
initialMapCapacity
,
final int
the initial capacity used for value collections
initialSetCapacity
)

Creates an empty HashSetValuedHashMap with the specified initial map and list capacities.

public
HashSetValuedHashMap(final MultiValuedMap<? extends K, ? extends V>
a MultiValuedMap to copy into this map
map
)

Creates an HashSetValuedHashMap copying all the mappings of the given map.

public
HashSetValuedHashMap(final Map<? extends K, ? extends V>
a Map to copy into this map
map
)

Creates an HashSetValuedHashMap copying all the mappings of the given map.

Method Summary

Modifier and TypeMethod and Description
protected HashSet<V>
createCollection()

Implements abstract org.apache.commons.collections4.multimap.AbstractSetValuedMap.createCollection.

Creates a new value collection using the provided factory.
private void
private void
Inherited from org.apache.commons.collections4.multimap.AbstractSetValuedMap:
getgetMapremovewrappedCollection

Field Detail

DEFAULT_INITIAL_MAP_CAPACITYback to summary
private static final int DEFAULT_INITIAL_MAP_CAPACITY

The initial map capacity used when none specified in constructor.

DEFAULT_INITIAL_SET_CAPACITYback to summary
private static final int DEFAULT_INITIAL_SET_CAPACITY

The initial set capacity when using none specified in constructor.

initialSetCapacityback to summary
private final int initialSetCapacity

The initial list capacity when creating a new value collection.

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization Version

Constructor Detail

HashSetValuedHashMapback to summary
public HashSetValuedHashMap()

Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the default initial set capacity (3).

HashSetValuedHashMapback to summary
public HashSetValuedHashMap(final int initialSetCapacity)

Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the specified initial set capacity.

Parameters
initialSetCapacity:int

the initial capacity used for value collections

HashSetValuedHashMapback to summary
public HashSetValuedHashMap(final int initialMapCapacity, final int initialSetCapacity)

Creates an empty HashSetValuedHashMap with the specified initial map and list capacities.

Parameters
initialMapCapacity:int

the initial hashmap capacity

initialSetCapacity:int

the initial capacity used for value collections

HashSetValuedHashMapback to summary
public HashSetValuedHashMap(final MultiValuedMap<? extends K, ? extends V> map)

Creates an HashSetValuedHashMap copying all the mappings of the given map.

Parameters
map:MultiValuedMap<? extends K, ? extends V>

a MultiValuedMap to copy into this map

HashSetValuedHashMapback to summary
public HashSetValuedHashMap(final Map<? extends K, ? extends V> map)

Creates an HashSetValuedHashMap copying all the mappings of the given map.

Parameters
map:Map<? extends K, ? extends V>

a Map to copy into this map

Method Detail

createCollectionback to summary
protected HashSet<V> createCollection()

Implements abstract org.apache.commons.collections4.multimap.AbstractSetValuedMap.createCollection.

Doc from org.apache.commons.collections4.multimap.AbstractSetValuedMap.createCollection.

Creates a new value collection using the provided factory.

Returns:HashSet<V>

a new list

Annotations
@Override
readObjectback to summary
private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException
writeObjectback to summary
private void writeObject(final ObjectOutputStream oos) throws IOException