org.modeshape.common.collection
Class ArrayListMultimap<K,V>
java.lang.Object
org.modeshape.common.collection.AbstractMultimap<K,V>
org.modeshape.common.collection.ArrayListMultimap<K,V>
- Type Parameters:
K - the key typeV - the value type
- All Implemented Interfaces:
- ListMultimap<K,V>, Multimap<K,V>
public class ArrayListMultimap<K,V>
- extends AbstractMultimap<K,V>
- implements ListMultimap<K,V>
A Multimap implementation that uses an ArrayList to store the values associated with a key. This implementation
allows duplicates and the values are ordered.
| Methods inherited from class org.modeshape.common.collection.AbstractMultimap |
asMap, clear, containsEntry, containsKey, containsValue, createEntryIterator, createUnmodifiable, entries, equals, getOrCreateCollection, hashCode, isEmpty, keySet, put, rawData, remove, removeAll, removeAllValuesForKey, size, toString, values, wrapCollection, wrapKeySet, wrapList, wrapMap |
| Methods inherited from interface org.modeshape.common.collection.Multimap |
asMap, clear, containsEntry, containsKey, containsValue, entries, isEmpty, keySet, put, remove, removeAll, size, values |
ArrayListMultimap
protected ArrayListMultimap()
create
public static <K,V> ArrayListMultimap<K,V> create()
- Creates a new, empty
LinkedHashMultimap (that allows no duplicates) with the default initial capacity.
- Type Parameters:
K - the key typeV - the value type
- Returns:
- the new linked-hash multimap; never null
createCollection
protected Collection<V> createCollection()
-
- Specified by:
createCollection in class AbstractMultimap<K,V>
- See Also:
AbstractMultimap.createCollection()
createUnmodifiableEmptyCollection
protected Collection<V> createUnmodifiableEmptyCollection()
-
- Specified by:
createUnmodifiableEmptyCollection in class AbstractMultimap<K,V>
- See Also:
AbstractMultimap.createUnmodifiableEmptyCollection()
get
public List<V> get(K key)
- Get the collection of values that are associated with the supplied key.
Changes to the returned collection will update the values that this multimap associates with the key.
- Specified by:
get in interface ListMultimap<K,V>- Specified by:
get in interface Multimap<K,V>- Overrides:
get in class AbstractMultimap<K,V>
- Parameters:
key - the key
- Returns:
- the collection of values, or an empty collection if the supplied key was not associated with any values
- See Also:
AbstractMultimap.get(java.lang.Object)
Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.