org.apache.openjpa.lib.util.concurrent
Class NullSafeConcurrentHashMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.concurrent.ConcurrentHashMap
          extended by org.apache.openjpa.lib.util.concurrent.NullSafeConcurrentHashMap
All Implemented Interfaces:
Serializable, ConcurrentMap, Map
Direct Known Subclasses:
SizedConcurrentHashMap

public class NullSafeConcurrentHashMap
extends ConcurrentHashMap

A subclass of ConcurrentHashMap that allows null keys and values. In exchange, it weakens the contract of putIfAbsent(java.lang.Object, java.lang.Object) and the other concurrent methods added in #ConcurrentHashMap.

Since:
1.1.0
See Also:
Serialized Form

Nested Class Summary
static interface NullSafeConcurrentHashMap.KeyFilter
           
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
NullSafeConcurrentHashMap()
           
NullSafeConcurrentHashMap(int size, float load, int concurrencyLevel)
           
 
Method Summary
 boolean contains(Object value)
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Enumeration elements()
           
 Set entrySet()
           
 Object get(Object key)
           
 Enumeration keys()
           
 Set keySet()
           
 Object put(Object key, Object value)
           
 Object putIfAbsent(Object key, Object value)
           
 Iterator<Map.Entry> randomEntryIterator()
          The returned data structure should not be shared among multiple threads.
 Object remove(Object key)
           
 boolean remove(Object key, Object value)
           
 Map.Entry removeRandom()
           
 Object replace(Object key, Object value)
           
 boolean replace(Object key, Object oldValue, Object newValue)
           
 Collection values()
           
 
Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, isEmpty, putAll, size
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

NullSafeConcurrentHashMap

public NullSafeConcurrentHashMap(int size,
                                 float load,
                                 int concurrencyLevel)

NullSafeConcurrentHashMap

public NullSafeConcurrentHashMap()
Method Detail

removeRandom

public Map.Entry removeRandom()

randomEntryIterator

public Iterator<Map.Entry> randomEntryIterator()
The returned data structure should not be shared among multiple threads.


remove

public Object remove(Object key)
Specified by:
remove in interface Map
Overrides:
remove in class ConcurrentHashMap

remove

public boolean remove(Object key,
                      Object value)
Specified by:
remove in interface ConcurrentMap
Overrides:
remove in class ConcurrentHashMap

replace

public boolean replace(Object key,
                       Object oldValue,
                       Object newValue)
Specified by:
replace in interface ConcurrentMap
Overrides:
replace in class ConcurrentHashMap

replace

public Object replace(Object key,
                      Object value)
Specified by:
replace in interface ConcurrentMap
Overrides:
replace in class ConcurrentHashMap

putIfAbsent

public Object putIfAbsent(Object key,
                          Object value)
Specified by:
putIfAbsent in interface ConcurrentMap
Overrides:
putIfAbsent in class ConcurrentHashMap

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map
Overrides:
put in class ConcurrentHashMap

get

public Object get(Object key)
Specified by:
get in interface Map
Overrides:
get in class ConcurrentHashMap

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map
Overrides:
containsKey in class ConcurrentHashMap

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map
Overrides:
containsValue in class ConcurrentHashMap

contains

public boolean contains(Object value)
Overrides:
contains in class ConcurrentHashMap

elements

public Enumeration elements()
Overrides:
elements in class ConcurrentHashMap

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
Overrides:
entrySet in class ConcurrentHashMap

keys

public Enumeration keys()
Overrides:
keys in class ConcurrentHashMap

keySet

public Set keySet()
Specified by:
keySet in interface Map
Overrides:
keySet in class ConcurrentHashMap

values

public Collection values()
Specified by:
values in interface Map
Overrides:
values in class ConcurrentHashMap


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.