|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,V>
org.apache.myfaces.trinidadinternal.util.OptimisticHashMap<K,V>
public class OptimisticHashMap<K,V>
A Map implementation that behaves like a Hashtable with optimistic synchronization of gets. This results in the following behavior:
Constructor Summary | |
---|---|
OptimisticHashMap()
Constructs a new, empty OptimisticHashMap with a default capacity and load factor, which is 0.75. |
|
OptimisticHashMap(int initialCapacity)
Constructs a new, empty OptimisticHashMap with the specified initial capacity and default load factor, which is 0.75. |
|
OptimisticHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty OptimisticHashMap with the specified initial capacity and the specified load factor. |
Method Summary | |
---|---|
void |
clear()
Clears this hashtable so that it contains no keys. |
java.lang.Object |
clone()
Creates a shallow copy of this OptimisticHashMap. |
boolean |
contains(java.lang.Object value)
Tests if some key maps into the specified value in this hashtable. |
boolean |
containsKey(java.lang.Object key)
Tests if the specified object is a key in this hashtable. |
java.util.Enumeration<V> |
elements()
Returns an enumeration of the values in this hashtable. |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
Returns the value to which the specified key is mapped in this hashtable. |
boolean |
isEmpty()
Tests if this hashtable maps no keys to values. |
java.util.Enumeration<K> |
keys()
Returns an enumeration of the keys in this hashtable. |
V |
put(K key,
V value)
Maps the specified key to the specified
value in this hashtable. |
protected void |
rehash()
Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently. |
V |
remove(java.lang.Object key)
Removes the key (and its corresponding value) from this hashtable. |
int |
size()
Returns the number of keys in this hashtable. |
java.lang.String |
toString()
Returns a string representation of this OptimisticHashMap object in the form of a set of entries, enclosed in braces and separated by the ASCII characters ", " (comma and space). |
Methods inherited from class java.util.AbstractMap |
---|
containsValue, equals, hashCode, keySet, putAll, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OptimisticHashMap(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the hashtable.loadFactor
- the load factor of the hashtable.
java.lang.IllegalArgumentException
- if the initial capacity is less
than zero, or if the load factor is nonpositive.public OptimisticHashMap(int initialCapacity)
initialCapacity
- the initial capacity of the hashtable.
java.lang.IllegalArgumentException
- if the initial capacity is less
than zero.public OptimisticHashMap()
Method Detail |
---|
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
entrySet
in class java.util.AbstractMap<K,V>
public int size()
size
in interface java.util.Map<K,V>
size
in class java.util.AbstractMap<K,V>
public boolean isEmpty()
isEmpty
in interface java.util.Map<K,V>
isEmpty
in class java.util.AbstractMap<K,V>
true
if this hashtable maps no keys to values;
false
otherwise.public java.util.Enumeration<K> keys()
Enumeration
public java.util.Enumeration<V> elements()
Enumeration
,
keys()
public boolean contains(java.lang.Object value)
containsKey
method.
value
- a value to search for.
true
if and only if some key maps to the
value
argument in this hashtable as
determined by the equals method;
false
otherwise.
java.lang.NullPointerException
- if the value is null
.containsKey(Object)
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in class java.util.AbstractMap<K,V>
key
- possible key.
true
if and only if the specified object
is a key in this hashtable, as determined by the
equals method; false
otherwise.contains(Object)
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
get
in class java.util.AbstractMap<K,V>
key
- a key in the hashtable.
null
if the key is not mapped to any value in
this hashtable.put(Object, Object)
protected void rehash()
public V put(K key, V value)
key
to the specified
value
in this hashtable. Neither the key nor the
value can be null
.
The value can be retrieved by calling the get
method
with a key that is equal to the original key.
put
in interface java.util.Map<K,V>
put
in class java.util.AbstractMap<K,V>
key
- the hashtable key.value
- the value.
java.lang.NullPointerException
- if the key or value is
null
.Object.equals(Object)
,
get(Object)
public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
remove
in class java.util.AbstractMap<K,V>
key
- the key that needs to be removed.
null
if the key did not have a mapping.public void clear()
clear
in interface java.util.Map<K,V>
clear
in class java.util.AbstractMap<K,V>
public java.lang.Object clone()
clone
in class java.util.AbstractMap<K,V>
public java.lang.String toString()
Overrides to toString method of Object.
toString
in class java.util.AbstractMap<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |