|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
org.cojen.util.ReferencedValueHashMap<K,V>
public abstract class ReferencedValueHashMap<K,V>
A Map that references its values and can be used as a simple cache. Instances are not thread-safe and must be wrapped with Collections.synchronizedMap to be made thread-safe.
Note: Referenced entries may be automatically removed during either accessor or mutator operations, possibly causing a concurrent modification to be detected. Therefore, even if multiple threads are only accessing this map, be sure to synchronize this map first. Also, do not rely on the value returned by size() when using an iterator from this map. The iterators may return less entries than the amount reported by size().
| Constructor Summary | |
|---|---|
ReferencedValueHashMap()
Constructs a new, empty map with a default capacity and load factor, which is 0.75. |
|
ReferencedValueHashMap(int initialCapacity)
Constructs a new, empty map with the specified initial capacity and default load factor, which is 0.75. |
|
ReferencedValueHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty map with the specified initial capacity and the specified load factor. |
|
ReferencedValueHashMap(Map<? extends K,? extends V> t)
Constructs a new map with the same mappings as the given map. |
|
| Method Summary | |
|---|---|
void |
clear()
|
Object |
clone()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
|
boolean |
isEmpty()
|
Set<K> |
keySet()
|
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> t)
|
V |
remove(Object key)
|
int |
size()
|
String |
toString()
|
Collection<V> |
values()
|
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode |
| 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 |
|---|
public ReferencedValueHashMap(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity of the HashMap.loadFactor - the load factor of the HashMap
IllegalArgumentException - if the initial capacity is less
than zero, or if the load factor is nonpositive.public ReferencedValueHashMap(int initialCapacity)
initialCapacity - the initial capacity of the HashMap.
IllegalArgumentException - if the initial capacity is less
than zero.public ReferencedValueHashMap()
public ReferencedValueHashMap(Map<? extends K,? extends V> t)
| Method Detail |
|---|
public int size()
size in interface Map<K,V>size in class AbstractMap<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>isEmpty in class AbstractMap<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>containsValue in class AbstractMap<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>public V get(Object key)
get in interface Map<K,V>get in class AbstractMap<K,V>
public V put(K key,
V value)
put in interface Map<K,V>put in class AbstractMap<K,V>public V remove(Object key)
remove in interface Map<K,V>remove in class AbstractMap<K,V>public void putAll(Map<? extends K,? extends V> t)
putAll in interface Map<K,V>putAll in class AbstractMap<K,V>public void clear()
clear in interface Map<K,V>clear in class AbstractMap<K,V>public Object clone()
clone in class AbstractMap<K,V>public Set<K> keySet()
keySet in interface Map<K,V>keySet in class AbstractMap<K,V>public Collection<V> values()
values in interface Map<K,V>values in class AbstractMap<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>entrySet in class AbstractMap<K,V>public String toString()
toString in class AbstractMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||