|
2010 FRC Java API |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.squawk.util.IntHashtable
com.sun.squawk.debugger.sda.WeakIntHashtable
public final class WeakIntHashtable
This class extends an IntHashtable
in two important ways:
1. It wraps all inserted values in a WeakReference.
2. It compares all (wrapped) values using reference equality as opposed to Object.equals(java.lang.Object)
.
Field Summary |
---|
Fields inherited from class com.sun.squawk.util.IntHashtable |
---|
count, table, threshold |
Constructor Summary | |
---|---|
WeakIntHashtable()
Constructs a new, empty hashtable with a default capacity and load factor. |
Method Summary | |
---|---|
void |
compact()
Removes all the entries whose wrapped objects have been collected or cleared. |
boolean |
contains(Object value)
Tests if some key maps into the specified value in this hashtable. This implementation uses reference equality when comparing values. |
Object |
get(int key)
Returns the value to which key is mapped in this hashtable. |
Integer |
getKey(Object value)
Gets the key for a given value in this table. |
Object |
put(int key,
Object value)
Maps the specified key to the specified
value in this hashtable. |
Methods inherited from class com.sun.squawk.util.IntHashtable |
---|
clear, containsKey, elements, isEmpty, keys, rehash, remove, size, toString, visit |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WeakIntHashtable()
Method Detail |
---|
public void compact()
public boolean contains(Object value)
containsKey
method.
This implementation uses reference equality when comparing values.
contains
in class IntHashtable
value
- a value to search for.
true
if some key maps to the
value
argument in this hashtable;
false
otherwise.Hashtable.containsKey(java.lang.Object)
public Object get(int key)
key
is mapped in this hashtable.
This will return null if key
does not map to a value or the value
has been garbage collected.
get
in class IntHashtable
key
- the key to search for
key
or nullHashtable.put(java.lang.Object, java.lang.Object)
public Integer getKey(Object value)
value
using reference equality as opposed to Object.equals(java.lang.Object)
.
value
- the value for which the key is requested
value
or null if value
is not in this tablepublic Object put(int key, Object value) throws IllegalArgumentException
key
to the specified
value
in this hashtable. Neither the key nor the
value can be null
.
If value
is an instanceof WeakReference
, then it is
directly inserted in the table otherwise value
is wrapped
in a WeakReference
before being inserted. However, value
retrieved by calling the get
method will always be the
value within the WeakReference.
put
in class IntHashtable
key
- the keyvalue
- the value
key
IllegalArgumentException
- if value instanceof WeakReference
and
the referent is a WeakReference itselfObject.equals(java.lang.Object)
,
Hashtable.get(java.lang.Object)
|
2010 FRC Java API |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |