|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractMap | +--java.util.WeakHashMap
Untamed:
Field Summary | |
private static int |
DEFAULT_INITIAL_CAPACITY
The default initial capacity -- MUST be a power of two. |
private static float |
DEFAULT_LOAD_FACTOR
The load fast used when none specified in constructor. |
private Set |
entrySet
|
private float |
loadFactor
The load factor for the hash table. |
private static int |
MAXIMUM_CAPACITY
The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments. |
private int |
modCount
The number of times this HashMap has been structurally modified Structural modifications are those that change the number of mappings in the HashMap or otherwise modify its internal structure (e.g., rehash). |
private static Object |
NULL_KEY
Value representing null keys inside tables. |
private java.lang.ref.ReferenceQueue |
queue
Reference queue for cleared WeakEntries |
private int |
size
The number of key-value mappings contained in this weak hash map. |
private java.util.WeakHashMap.Entry[] |
table
The table, resized as necessary. |
private int |
threshold
The next size value at which to resize (capacity * load factor). |
Fields inherited from class java.util.AbstractMap |
keySet, values |
Constructor Summary | |
WeakHashMap()
Enabled: Constructs a new, empty WeakHashMap with the default initial capacity (16) and the default load factor (0.75). |
|
WeakHashMap(int initialCapacity)
Enabled: Constructs a new, empty WeakHashMap with the given initial capacity and the default load factor, which is 0.75. |
|
WeakHashMap(int initialCapacity,
float loadFactor)
Enabled: Constructs a new, empty WeakHashMap with the given initial capacity and the given load factor. |
|
WeakHashMap(Map t)
Enabled: Constructs a new WeakHashMap with the same mappings as the specified Map. |
Method Summary | |
void |
clear()
Enabled: Removes all mappings from this map. |
boolean |
containsKey(Object key)
Enabled: Returns true if this map contains a mapping for the specified key. |
private boolean |
containsNullValue()
Special-case code for containsValue with null argument |
boolean |
containsValue(Object value)
Enabled: Returns true if this map maps one or more keys to the specified value. |
Set |
entrySet()
Enabled: Returns a collection view of the mappings contained in this map. |
(package private) static boolean |
eq(Object x,
Object y)
Check for equality of non-null reference x and possibly-null y. |
private void |
expungeStaleEntries()
Expunge stale entries from the table. |
Object |
get(Object key)
Enabled: Returns the value to which the specified key is mapped in this weak hash map, or null if the map contains no mapping for this key. |
(package private) java.util.WeakHashMap.Entry |
getEntry(Object key)
Returns the entry associated with the specified key in the HashMap. |
private java.util.WeakHashMap.Entry[] |
getTable()
Return the table after first expunging stale entries |
(package private) static int |
indexFor(int h,
int length)
Return index for hash code h. |
boolean |
isEmpty()
Enabled: Returns true if this map contains no key-value mappings. |
Set |
keySet()
Enabled: Returns a set view of the keys contained in this map. |
private static Object |
maskNull(Object key)
Use NULL_KEY for key if it is null. |
Object |
put(Object key,
Object value)
Enabled: Associates the specified value with the specified key in this map. |
void |
putAll(Map t)
Enabled: Copies all of the mappings from the specified map to this map These mappings will replace any mappings that this map had for any of the keys currently in the specified map. |
Object |
remove(Object key)
Enabled: Removes the mapping for this key from this map if present. |
(package private) java.util.WeakHashMap.Entry |
removeMapping(Object o)
Special version of remove needed by Entry set |
(package private) void |
resize(int newCapacity)
Rehashes the contents of this map into a new HashMap instance with a larger capacity. |
int |
size()
Enabled: Returns the number of key-value mappings in this map. |
private void |
transfer(java.util.WeakHashMap.Entry[] src,
java.util.WeakHashMap.Entry[] dest)
Transfer all entries from src to dest tables |
private static Object |
unmaskNull(Object key)
Return internal representation of null key back to caller as null |
Collection |
values()
Enabled: Returns a collection view of the values contained in this map. |
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 |
Field Detail |
private static final int DEFAULT_INITIAL_CAPACITY
private static final int MAXIMUM_CAPACITY
private static final float DEFAULT_LOAD_FACTOR
private java.util.WeakHashMap.Entry[] table
private int size
private int threshold
private final float loadFactor
private final java.lang.ref.ReferenceQueue queue
private volatile int modCount
private static final Object NULL_KEY
private transient Set entrySet
Constructor Detail |
public WeakHashMap(int initialCapacity, float loadFactor)
initialCapacity
- The initial capacity of the WeakHashMaploadFactor
- The load factor of the WeakHashMap
IllegalArgumentException
- If the initial capacity is negative,
or if the load factor is nonpositive.public WeakHashMap(int initialCapacity)
initialCapacity
- The initial capacity of the WeakHashMap
IllegalArgumentException
- If the initial capacity is negative.public WeakHashMap()
public WeakHashMap(Map t)
t
- the map whose mappings are to be placed in this map.
NullPointerException
- if the specified map is null.Method Detail |
private static Object maskNull(Object key)
private static Object unmaskNull(Object key)
static boolean eq(Object x, Object y)
static int indexFor(int h, int length)
private void expungeStaleEntries()
private java.util.WeakHashMap.Entry[] getTable()
public int size()
size
in interface Map
size
in class AbstractMap
public boolean isEmpty()
isEmpty
in interface Map
isEmpty
in class AbstractMap
public Object get(Object key)
get
in interface Map
get
in class AbstractMap
key
- the key whose associated value is to be returned.
put(Object, Object)
public boolean containsKey(Object key)
containsKey
in interface Map
containsKey
in class AbstractMap
key
- The key whose presence in this map is to be tested
java.util.WeakHashMap.Entry getEntry(Object key)
public Object put(Object key, Object value)
put
in interface Map
put
in class AbstractMap
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
void resize(int newCapacity)
newCapacity
- the new capacity, MUST be a power of two.private void transfer(java.util.WeakHashMap.Entry[] src, java.util.WeakHashMap.Entry[] dest)
public void putAll(Map t)
putAll
in interface Map
putAll
in class AbstractMap
t
- mappings to be stored in this map.
NullPointerException
- if the specified map is null.public Object remove(Object key)
remove
in interface Map
remove
in class AbstractMap
key
- key whose mapping is to be removed from the map.
java.util.WeakHashMap.Entry removeMapping(Object o)
public void clear()
clear
in interface Map
clear
in class AbstractMap
public boolean containsValue(Object value)
containsValue
in interface Map
containsValue
in class AbstractMap
value
- value whose presence in this map is to be tested.
private boolean containsNullValue()
public Set keySet()
keySet
in interface Map
keySet
in class AbstractMap
public Collection values()
values
in interface Map
values
in class AbstractMap
public Set entrySet()
entrySet
in interface Map
entrySet
in class AbstractMap
Map.Entry
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |