com.sun.faces.util
public class MultiKeyConcurrentHashMap<K,V> extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MultiKeyConcurrentHashMap.HashEntry<K,V>
ConcurrentHashMap list entry.
|
(package private) static class |
MultiKeyConcurrentHashMap.Segment<K,V>
Segments are specialized versions of hash tables.
|
Modifier and Type | Field and Description |
---|---|
(package private) static int |
DEFAULT_INITIAL_CAPACITY
The default initial number of table slots for this table.
|
(package private) static float |
DEFAULT_LOAD_FACTOR
The default load factor for this table.
|
(package private) static int |
DEFAULT_SEGMENTS
The default number of concurrency control segments.
|
(package private) static int |
MAX_SEGMENTS
The maximum number of segments to allow; used to bound constructor
arguments.
|
(package private) static int |
MAXIMUM_CAPACITY
The maximum capacity, used if a higher value is implicitly specified by
either of the constructors with arguments.
|
(package private) static int |
RETRIES_BEFORE_LOCK
Number of unsynchronized retries in size and containsValue methods before
resorting to locking.
|
(package private) int |
segmentMask
Mask value for indexing into segments.
|
(package private) MultiKeyConcurrentHashMap.Segment[] |
segments
The segments, each of which is a specialized hash table
|
(package private) int |
segmentShift
Shift value for indexing within segments.
|
Constructor and Description |
---|
MultiKeyConcurrentHashMap()
Creates a new, empty map with a default initial capacity, load factor,
and concurrencyLevel.
|
MultiKeyConcurrentHashMap(int initialCapacity)
Creates a new, empty map with the specified initial capacity, and with
default load factor and concurrencyLevel.
|
MultiKeyConcurrentHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel)
Creates a new, empty map with the specified initial capacity, load
factor, and concurrency level.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all mappings from this map.
|
boolean |
contains(java.lang.Object value)
Legacy method testing if some key maps into the specified value in this
table.
|
boolean |
containsKey(java.lang.Object key)
Tests if the specified object is a key in this table.
|
boolean |
containsKey(java.lang.Object key1,
java.lang.Object key2) |
boolean |
containsKey(java.lang.Object key1,
java.lang.Object key2,
java.lang.Object key3) |
boolean |
containsKey(java.lang.Object key1,
java.lang.Object key2,
java.lang.Object key3,
java.lang.Object key4) |
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified
value.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Unsupported.
|
V |
get(java.lang.Object key)
Returns the value to which the specified key is mapped in this table.
|
V |
get(java.lang.Object key1,
java.lang.Object key2) |
V |
get(java.lang.Object key1,
java.lang.Object key2,
java.lang.Object key3) |
V |
get(java.lang.Object key1,
java.lang.Object key2,
java.lang.Object key3,
java.lang.Object key4) |
(package private) static int |
hash(java.lang.Object x1,
java.lang.Object x2,
java.lang.Object x3,
java.lang.Object x4)
Returns a hash code for non-null Objects.
|
boolean |
isEmpty() |
java.util.Set<K> |
keySet()
Unsupported
|
V |
put(K key1,
K key2,
K key3,
K key4,
V value) |
V |
put(K key1,
K key2,
K key3,
V value) |
V |
put(K key1,
K key2,
V value) |
V |
put(K key,
V value)
Maps the specified key to the specified value in this
table.
|
V |
putIfAbsent(K key1,
K key2,
K key3,
K key4,
V value) |
V |
putIfAbsent(K key1,
K key2,
K key3,
V value) |
V |
putIfAbsent(K key1,
K key2,
V value) |
V |
putIfAbsent(K key,
V value)
If the specified key is not already associated with a value, associate it
with the given value.
|
V |
remove(K key) |
V |
remove(K key1,
K key2) |
V |
remove(K key1,
K key2,
K key3) |
V |
remove(K key1,
K key2,
K key3,
K key4) |
V |
replace(K key,
V value)
Replace entry for key only if currently mapped to some value.
|
boolean |
replace(K key,
V oldValue,
V newValue)
Replace entry for key only if currently mapped to given value.
|
(package private) MultiKeyConcurrentHashMap.Segment<K,V> |
segmentFor(int hash)
Returns the segment that should be used for key with given hash
|
int |
size() |
java.util.Collection<V> |
values()
Unsupported.
|
static int DEFAULT_INITIAL_CAPACITY
static final int MAXIMUM_CAPACITY
static final float DEFAULT_LOAD_FACTOR
static final int DEFAULT_SEGMENTS
static final int MAX_SEGMENTS
static final int RETRIES_BEFORE_LOCK
final int segmentMask
final int segmentShift
final MultiKeyConcurrentHashMap.Segment[] segments
public MultiKeyConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel)
initialCapacity
- the initial capacity. The implementation performs
internal sizing to accommodate this many
elements.loadFactor
- the load factor threshold, used to control
resizing. Resizing may be performed when the
average number of elements per bin exceeds this
threshold.concurrencyLevel
- the estimated number of concurrently updating
threads. The implementation performs internal
sizing to try to accommodate this many threads.java.lang.IllegalArgumentException
- if the initial capacity is negative or
the load factor or concurrencyLevel are
nonpositive.public MultiKeyConcurrentHashMap(int initialCapacity)
initialCapacity
- the initial capacity. The implementation performs
internal sizing to accommodate this many
elements.java.lang.IllegalArgumentException
- if the initial capacity of elements is
negative.public MultiKeyConcurrentHashMap()
static int hash(java.lang.Object x1, java.lang.Object x2, java.lang.Object x3, java.lang.Object x4)
final MultiKeyConcurrentHashMap.Segment<K,V> segmentFor(int hash)
hash
- the hash code for the keypublic boolean isEmpty()
Map.isEmpty()
public int size()
Map.size()
public V get(java.lang.Object key)
key
- a key in the table.java.lang.NullPointerException
- if the key is null.public V get(java.lang.Object key1, java.lang.Object key2)
get(Object)
public V get(java.lang.Object key1, java.lang.Object key2, java.lang.Object key3)
get(Object)
public V get(java.lang.Object key1, java.lang.Object key2, java.lang.Object key3, java.lang.Object key4)
get(Object)
public boolean containsKey(java.lang.Object key)
key
- possible key.java.lang.NullPointerException
- if the key is null.public boolean containsKey(java.lang.Object key1, java.lang.Object key2)
containsKey(Object)
public boolean containsKey(java.lang.Object key1, java.lang.Object key2, java.lang.Object key3)
containsKey(Object)
public boolean containsKey(java.lang.Object key1, java.lang.Object key2, java.lang.Object key3, java.lang.Object key4)
containsKey(Object)
public boolean containsValue(java.lang.Object value)
value
- value whose presence in this map is to be tested.java.lang.NullPointerException
- if the value is null.public boolean contains(java.lang.Object value)
containsValue(java.lang.Object)
, and exists solely to ensure full compatibility with
class Hashtable
, which supported this method prior to
introduction of the Java Collections framework.value
- a value to search for.java.lang.NullPointerException
- if the value is null.public V put(K key, V value)
The value can be retrieved by calling the get method with a key that is equal to the original key.
key
- the table key.value
- the value.java.lang.NullPointerException
- if the key or value is null.public V put(K key1, K key2, V value)
put(Object, Object)
public V putIfAbsent(K key, V value)
if (!map.containsKey(key)) return map.put(key, value); else return map.get(key);Except that the action is performed atomically.
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.java.lang.NullPointerException
- if the specified key or value is
null.public V putIfAbsent(K key1, K key2, V value)
putIfAbsent(Object, Object)
public V putIfAbsent(K key1, K key2, K key3, V value)
putIfAbsent(Object, Object)
public V putIfAbsent(K key1, K key2, K key3, K key4, V value)
putIfAbsent(Object, Object)
public boolean replace(K key, V oldValue, V newValue)
if (map.get(key).equals(oldValue)) { map.put(key, newValue); return true; } else return false;except that the action is performed atomically.
key
- key with which the specified value is associated.oldValue
- value expected to be associated with the specified key.newValue
- value to be associated with the specified key.java.lang.NullPointerException
- if the specified key or values are
null.public V replace(K key, V value)
if ((map.containsKey(key)) { return map.put(key, value); } else return null;except that the action is performed atomically.
key
- key with which the specified value is associated.value
- value to be associated with the specified key.java.lang.NullPointerException
- if the specified key or value is
null.public void clear()
public java.util.Set<K> keySet()
public java.util.Collection<V> values()
Copyright © 2002-2010 Oracle America, Inc. All Rights Reserved.