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

public Class ArrayListValuedHashMap<K, V>

extends AbstractListValuedMap<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.ArrayList, .Collection, .HashMap, .Map, org.apache.commons.collections4.MultiValuedMap

Implements a 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.

Since
4.1

Field Summary

Modifier and TypeField and Description
private static final int
DEFAULT_INITIAL_LIST_CAPACITY

The initial list capacity when using none specified in constructor.

private static final int
DEFAULT_INITIAL_MAP_CAPACITY

The initial map capacity used when none specified in constructor.

private final int
initialListCapacity

The initial list capacity when creating a new value collection.

private static final long
serialVersionUID

Serialization Version

Constructor Summary

AccessConstructor and Description
public
ArrayListValuedHashMap()

Creates an empty ArrayListValuedHashMap with the default initial map capacity (16) and the default initial list capacity (3).

public
ArrayListValuedHashMap(final int
the initial capacity used for value collections
initialListCapacity
)

Creates an empty ArrayListValuedHashMap with the default initial map capacity (16) and the specified initial list capacity.

public
ArrayListValuedHashMap(final int
the initial hashmap capacity
initialMapCapacity
,
final int
the initial capacity used for value collections
initialListCapacity
)

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

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

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

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

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

Method Summary

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

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

Creates a new value collection using the provided factory.
private void
public void
trimToSize()

Trims the capacity of all value collections to their current size.

private void
Inherited from org.apache.commons.collections4.multimap.AbstractListValuedMap:
getgetMapremovewrappedCollection

Field Detail

DEFAULT_INITIAL_LIST_CAPACITYback to summary
private static final int DEFAULT_INITIAL_LIST_CAPACITY

The initial list capacity when using none specified in constructor.

DEFAULT_INITIAL_MAP_CAPACITYback to summary
private static final int DEFAULT_INITIAL_MAP_CAPACITY

The initial map capacity used when none specified in constructor.

initialListCapacityback to summary
private final int initialListCapacity

The initial list capacity when creating a new value collection.

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization Version

Constructor Detail

ArrayListValuedHashMapback to summary
public ArrayListValuedHashMap()

Creates an empty ArrayListValuedHashMap with the default initial map capacity (16) and the default initial list capacity (3).

ArrayListValuedHashMapback to summary
public ArrayListValuedHashMap(final int initialListCapacity)

Creates an empty ArrayListValuedHashMap with the default initial map capacity (16) and the specified initial list capacity.

Parameters
initialListCapacity:int

the initial capacity used for value collections

ArrayListValuedHashMapback to summary
public ArrayListValuedHashMap(final int initialMapCapacity, final int initialListCapacity)

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

Parameters
initialMapCapacity:int

the initial hashmap capacity

initialListCapacity:int

the initial capacity used for value collections

ArrayListValuedHashMapback to summary
public ArrayListValuedHashMap(final MultiValuedMap<? extends K, ? extends V> map)

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

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

a MultiValuedMap to copy into this map

ArrayListValuedHashMapback to summary
public ArrayListValuedHashMap(final Map<? extends K, ? extends V> map)

Creates an ArrayListValuedHashMap 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 ArrayList<V> createCollection()

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

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

Creates a new value collection using the provided factory.

Returns:ArrayList<V>

a new list

Annotations
@Override
readObjectback to summary
private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException
trimToSizeback to summary
public void trimToSize()

Trims the capacity of all value collections to their current size.

writeObjectback to summary
private void writeObject(final ObjectOutputStream oos) throws IOException