K
- the type of the keys in this mapV
- the type of the values in this mappublic class HashSetValuedHashMap<K,V> extends AbstractSetValuedMap<K,V> implements java.io.Serializable
SetValuedMap
, using a HashMap
to provide data
storage and HashSet
s 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.
AbstractMultiValuedMap.WrappedCollection
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_INITIAL_MAP_CAPACITY
The initial map capacity used when none specified in constructor.
|
private static int |
DEFAULT_INITIAL_SET_CAPACITY
The initial set capacity when using none specified in constructor.
|
private int |
initialSetCapacity
The initial list capacity when creating a new value collection.
|
private static long |
serialVersionUID
Serialization Version
|
Constructor and Description |
---|
HashSetValuedHashMap()
Creates 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(java.util.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.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.HashSet<V> |
createCollection()
Creates a new value collection using the provided factory.
|
private void |
readObject(java.io.ObjectInputStream ois) |
private void |
writeObject(java.io.ObjectOutputStream oos) |
get, getMap, remove, wrappedCollection
asMap, clear, containsKey, containsMapping, containsValue, doReadObject, doWriteObject, entries, equals, hashCode, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, setMap, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asMap, clear, containsKey, containsMapping, containsValue, entries, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, size, values
private static final long serialVersionUID
private static final int DEFAULT_INITIAL_MAP_CAPACITY
private static final int DEFAULT_INITIAL_SET_CAPACITY
private final int initialSetCapacity
public HashSetValuedHashMap()
public HashSetValuedHashMap(int initialSetCapacity)
initialSetCapacity
- the initial capacity used for value collectionspublic HashSetValuedHashMap(int initialMapCapacity, int initialSetCapacity)
initialMapCapacity
- the initial hashmap capacityinitialSetCapacity
- the initial capacity used for value collectionspublic HashSetValuedHashMap(MultiValuedMap<? extends K,? extends V> map)
map
- a MultiValuedMap
to copy into this mapprotected java.util.HashSet<V> createCollection()
AbstractSetValuedMap
createCollection
in class AbstractSetValuedMap<K,V>
private void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream ois) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException