K - the type of the keys in this mapV - the type of the values in this mappublic class ArrayListValuedHashMap<K,V> extends AbstractListValuedMap<K,V> implements java.io.Serializable
ListValuedMap, using a HashMap to provide data
storage and ArrayLists as value collections. This is the standard
implementation of a ListValuedMap.
Note that ArrayListValuedHashMap 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_LIST_CAPACITY
The initial list capacity when using none specified in constructor.
|
private static int |
DEFAULT_INITIAL_MAP_CAPACITY
The initial map capacity used when none specified in constructor.
|
private int |
initialListCapacity
The initial list capacity when creating a new value collection.
|
private static long |
serialVersionUID
Serialization Version
|
| Constructor and Description |
|---|
ArrayListValuedHashMap()
Creates an empty ArrayListValuedHashMap with the default initial
map capacity (16) and the default initial list capacity (3).
|
ArrayListValuedHashMap(int initialListCapacity)
Creates an empty ArrayListValuedHashMap with the default initial
map capacity (16) and the specified initial list capacity.
|
ArrayListValuedHashMap(int initialMapCapacity,
int initialListCapacity)
Creates an empty ArrayListValuedHashMap with the specified initial
map and list capacities.
|
ArrayListValuedHashMap(java.util.Map<? extends K,? extends V> map)
Creates an ArrayListValuedHashMap copying all the mappings of the given map.
|
ArrayListValuedHashMap(MultiValuedMap<? extends K,? extends V> map)
Creates an ArrayListValuedHashMap copying all the mappings of the given map.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.util.ArrayList<V> |
createCollection()
Creates a new value collection using the provided factory.
|
private void |
readObject(java.io.ObjectInputStream ois) |
void |
trimToSize()
Trims the capacity of all value collections to their current size.
|
private void |
writeObject(java.io.ObjectOutputStream oos) |
get, getMap, remove, wrappedCollectionasMap, clear, containsKey, containsMapping, containsValue, doReadObject, doWriteObject, entries, equals, hashCode, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, setMap, size, toString, valuesclone, finalize, getClass, notify, notifyAll, wait, wait, waitasMap, clear, containsKey, containsMapping, containsValue, entries, isEmpty, keys, keySet, mapIterator, put, putAll, putAll, putAll, removeMapping, size, valuesprivate static final long serialVersionUID
private static final int DEFAULT_INITIAL_MAP_CAPACITY
private static final int DEFAULT_INITIAL_LIST_CAPACITY
private final int initialListCapacity
public ArrayListValuedHashMap()
public ArrayListValuedHashMap(int initialListCapacity)
initialListCapacity - the initial capacity used for value collectionspublic ArrayListValuedHashMap(int initialMapCapacity,
int initialListCapacity)
initialMapCapacity - the initial hashmap capacityinitialListCapacity - the initial capacity used for value collectionspublic ArrayListValuedHashMap(MultiValuedMap<? extends K,? extends V> map)
map - a MultiValuedMap to copy into this mapprotected java.util.ArrayList<V> createCollection()
AbstractListValuedMapcreateCollection in class AbstractListValuedMap<K,V>public void trimToSize()
private void writeObject(java.io.ObjectOutputStream oos)
throws java.io.IOException
java.io.IOExceptionprivate void readObject(java.io.ObjectInputStream ois)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundException