API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util.concurrent. ConcurrentHashMap View Source
Author(s)
Doug Lea
Since
1.5
Version
Serial
Hierarchy
 Object
      AbstractMap
          ConcurrentHashMap
Implements
 ConcurrentMap
 Serializable
Subclasses
Description
public class ConcurrentHashMap
  A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updates.
See also:   
Constructors
public ConcurrentHashMap ()
Creates a new, empty map with a default initial capacity (16), load factor (0.75) and concurrencyLevel (16).
public ConcurrentHashMap (int initialCapacity)
  Creates a new, empty map with the specified initial capacity, and with default load factor (0.75) and concurrencyLevel (16).
public ConcurrentHashMap (int initialCapacity, float loadFactor)
  Creates a new, empty map with the specified initial capacity and load factor and with the default concurrencyLevel (16).
public ConcurrentHashMap (int initialCapacity, float loadFactor, int concurrencyLevel)
  Creates a new, empty map with the specified initial capacity, load factor and concurrency level.
public ConcurrentHashMap (Map<Object, Object> m)
  Creates a new map with the same mappings as the given map.
Methods
Hide/Show inherited methods
public void clear () [Overrides AbstractMap]
Removes all of the mappings from this map.
protected Object clone () throws CloneNotSupportedException [Inherited From AbstractMap]
  Returns a shallow copy of this AbstractMap instance: the keys and values themselves are not cloned.
public boolean contains (Object value)
  Legacy method testing if some key maps into the specified value in this table.
public boolean containsKey (Object key) [Overrides AbstractMap]
  Tests if the specified object is a key in this table.
public boolean containsValue (Object value) [Overrides AbstractMap]
  Returns true if this map maps one or more keys to the specified value.
public Enumeration< V> elements ()
  Returns an enumeration of the values in this table.
public Set<Entry< K, V>> entrySet () [Specified in AbstractMap]
  Returns a Set view of the mappings contained in this map.
public boolean equals (Object o) [Inherited From AbstractMap]
  Compares the specified object with this map for equality.
public V get (Object key) [Overrides AbstractMap]
  Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
public int hashCode () [Inherited From AbstractMap]
  Returns the hash code value for this map.
public boolean isEmpty () [Overrides AbstractMap]
  Returns true if this map contains no key-value mappings.
public Enumeration< K> keys ()
  Returns an enumeration of the keys in this table.
public Set< K> keySet () [Overrides AbstractMap]
  Returns a Set view of the keys contained in this map.
public V put ( K key, V value) [Overrides AbstractMap]
  Maps the specified key to the specified value in this table.
public void putAll (Map<Object, Object> m) [Overrides AbstractMap]
  Copies all of the mappings from the specified map to this one.
public V putIfAbsent ( K key, V value) [Specified in ConcurrentMap]
  If the specified key is not already associated with a value, associate it with the given value.
public V remove (Object key) [Overrides AbstractMap]
  Removes the key (and its corresponding value) from this map.
public boolean remove (Object key, Object value) [Specified in ConcurrentMap]
  Removes the entry for a key only if currently mapped to a given value.
public V replace ( K key, V value) [Specified in ConcurrentMap]
  Replaces the entry for a key only if currently mapped to some value.
public boolean replace ( K key, V oldValue, V newValue) [Specified in ConcurrentMap]
  Replaces the entry for a key only if currently mapped to a given value.
pack-privatefinal Segment< K, V> segmentFor (int hash)
  Returns the segment that should be used for key with given hash
public int size () [Overrides AbstractMap]
  Returns the number of key-value mappings in this map.
public String toString () [Inherited From AbstractMap]
  Returns a string representation of this map.
public Collection< V> values () [Overrides AbstractMap]
  Returns a Collection view of the values contained in this map.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int DEFAULT_CONCURRENCY_LEVEL = "16"
The default concurrency level for this table, used when not otherwise specified in a constructor.
pack-privatefinalstatic int DEFAULT_INITIAL_CAPACITY = "16"
The default initial capacity for this table, used when not otherwise specified in a constructor.
pack-privatefinalstatic float DEFAULT_LOAD_FACTOR = "0.75"
The default load factor for this table, used when not otherwise specified in a constructor.
pack-privatetransient Set<Entry< K, V>> entrySet
pack-privatetransient Set< K> keySet
pack-privatefinalstatic int MAX_SEGMENTS = "65536"
The maximum number of segments to allow; used to bound constructor arguments.
pack-privatefinalstatic int MAXIMUM_CAPACITY = "1073741824"
  The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments.
pack-privatefinalstatic int RETRIES_BEFORE_LOCK = "2"
  Number of unsynchronized retries in size and containsValue methods before resorting to locking.
pack-privatefinal int segmentMask
  Mask value for indexing into segments.
pack-privatefinal Segment< K, V> segments
The segments, each of which is a specialized hash table
pack-privatefinal int segmentShift
Shift value for indexing within segments.
pack-privatetransient Collection< V> values
Nested Classes
  ConcurrentHashMap.HashEntry
ConcurrentHashMap list entry.
  ConcurrentHashMap.Segment
Segments are specialized versions of hash tables.
  ConcurrentHashMap.HashIterator
  ConcurrentHashMap.KeyIterator
  ConcurrentHashMap.ValueIterator
  ConcurrentHashMap.WriteThroughEntry
Custom Entry class used by EntryIterator.next(), that relays setValue changes to the underlying map.
  ConcurrentHashMap.EntryIterator
  ConcurrentHashMap.KeySet
  ConcurrentHashMap.Values
  ConcurrentHashMap.EntrySet
  AbstractMap.SimpleEntry
An Entry maintaining a key and a value.
  AbstractMap.SimpleImmutableEntry
An Entry maintaining an immutable key and value.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar