org.jboss.webbeans.util.collections.multi
Class ConcurrentListHashMultiMap<K,V>
java.lang.Object
org.jboss.webbeans.util.collections.ForwardingObject
org.jboss.webbeans.util.collections.ForwardingMap<K,V>
org.jboss.webbeans.util.collections.ForwardingConcurrentMap<K,ConcurrentList<V>>
org.jboss.webbeans.util.collections.multi.ConcurrentListHashMultiMap<K,V>
- All Implemented Interfaces:
- java.util.concurrent.ConcurrentMap<K,ConcurrentList<V>>, java.util.Map<K,ConcurrentList<V>>, ConcurrentListMultiMap<K,V>
public class ConcurrentListHashMultiMap<K,V>
- extends ForwardingConcurrentMap<K,ConcurrentList<V>>
- implements ConcurrentListMultiMap<K,V>
An concurrent multimap which is internally backed by a a ConcurrentHashMap
and a CopyOnWriteArrayList
- Author:
- Pete Muir
Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
Method Summary |
void |
deepPutAll(java.util.Map<? extends K,? extends ConcurrentList<V>> map)
Put all the data in the map into this map, copying each multi-value, not
just attaching the existing multi-value |
protected java.util.concurrent.ConcurrentMap<K,ConcurrentList<V>> |
delegate()
Returns the backing delegate instance that methods are forwarded to. |
ConcurrentList<V> |
get(java.lang.Object key)
Gets the list of values for a given key |
void |
put(K key,
V value)
Add a value, creating the list if it doesn't exist |
Methods inherited from class org.jboss.webbeans.util.collections.ForwardingMap |
clear, containsKey, containsValue, createEntrySet, createKeySet, createValues, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.concurrent.ConcurrentMap |
putIfAbsent, remove, replace, replace |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
ConcurrentListHashMultiMap
public ConcurrentListHashMultiMap()
- Constructor.
delegate
protected java.util.concurrent.ConcurrentMap<K,ConcurrentList<V>> delegate()
- Description copied from class:
ForwardingObject
- Returns the backing delegate instance that methods are forwarded to.
Abstract subclasses generally override the
ForwardingObject
method
with an abstract method that has a more specific return type, such as
ForwardingSet.delegate()
. Concrete subclasses override this method
to supply the instance being decorated.
- Specified by:
delegate
in class ForwardingConcurrentMap<K,ConcurrentList<V>>
deepPutAll
public void deepPutAll(java.util.Map<? extends K,? extends ConcurrentList<V>> map)
- Description copied from interface:
ConcurrentListMultiMap
- Put all the data in the map into this map, copying each multi-value, not
just attaching the existing multi-value
- Specified by:
deepPutAll
in interface ConcurrentListMultiMap<K,V>
- Parameters:
map
- the map to copy
get
public ConcurrentList<V> get(java.lang.Object key)
- Gets the list of values for a given key
- Specified by:
get
in interface java.util.Map<K,ConcurrentList<V>>
- Overrides:
get
in class ForwardingMap<K,ConcurrentList<V>>
- Parameters:
key
- the key
- Returns:
- The list of values. An empty list is returned if there are no
matches.
put
public void put(K key,
V value)
- Description copied from interface:
ConcurrentListMultiMap
- Add a value, creating the list if it doesn't exist
- Specified by:
put
in interface ConcurrentListMultiMap<K,V>
- Parameters:
key
- the key to store the value undervalue
- the value to add
Copyright © 2011. All Rights Reserved.