org.jboss.webbeans.util.collections.multi
Class ConcurrentSetHashMultiMap<K,V>

java.lang.Object
  extended by org.jboss.webbeans.util.collections.ForwardingObject
      extended by org.jboss.webbeans.util.collections.ForwardingMap<K,V>
          extended by org.jboss.webbeans.util.collections.ForwardingConcurrentMap<K,java.util.Set<V>>
              extended by org.jboss.webbeans.util.collections.multi.ConcurrentSetHashMultiMap<K,V>
All Implemented Interfaces:
java.util.concurrent.ConcurrentMap<K,java.util.Set<V>>, java.util.Map<K,java.util.Set<V>>, ConcurrentSetMultiMap<K,V>

public class ConcurrentSetHashMultiMap<K,V>
extends ForwardingConcurrentMap<K,java.util.Set<V>>
implements ConcurrentSetMultiMap<K,V>

An concurrent multimap which is internally backed by a a ConcurrentHashMap and a CopyOnWriteArraySet

Author:
Pete Muir

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
ConcurrentSetHashMultiMap()
          Constructor.
 
Method Summary
 void deepPutAll(java.util.Map<? extends K,? extends java.util.Set<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,java.util.Set<V>> delegate()
          Returns the backing delegate instance that methods are forwarded to.
 java.util.Set<V> get(java.lang.Object key)
          Gets the list of values for a given key
 void put(K key, V value)
          Add a value.
 
Methods inherited from class org.jboss.webbeans.util.collections.ForwardingConcurrentMap
putIfAbsent, remove, replace, replace
 
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 org.jboss.webbeans.util.collections.ForwardingObject
toString
 
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
 

Constructor Detail

ConcurrentSetHashMultiMap

public ConcurrentSetHashMultiMap()
Constructor.

Method Detail

deepPutAll

public void deepPutAll(java.util.Map<? extends K,? extends java.util.Set<V>> map)
Description copied from interface: ConcurrentSetMultiMap
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 ConcurrentSetMultiMap<K,V>
Parameters:
map - the map to copy

delegate

protected java.util.concurrent.ConcurrentMap<K,java.util.Set<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,java.util.Set<V>>

get

public java.util.Set<V> get(java.lang.Object key)
Gets the list of values for a given key

Specified by:
get in interface java.util.Map<K,java.util.Set<V>>
Overrides:
get in class ForwardingMap<K,java.util.Set<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: ConcurrentSetMultiMap
Add a value. The collection is automatically created. If the value already exists, it isn't added

Specified by:
put in interface ConcurrentSetMultiMap<K,V>
Parameters:
key - the key to add the value to
value - the value to add


Copyright © 2011. All Rights Reserved.