java.lang.ref
public abstract class Reference<T> extends Object
get()
-method. This method will return
null
if the object was collected. WeakHashtable
) as
you get notified when nobody has the key anymore.
Phantom references don't prevent finalization. If an object is only
phantom reachable, it will be finalized, and the reference will be
enqueued, but not cleared. Since you mustn't access an finalized
object, the get
method of a phantom reference will never
work. It is useful to keep track, when an object is finalized.java.util.WeakHashtable
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the reference, so that it doesn't refer to its object
anymore.
|
boolean |
enqueue()
Enqueue an object on a reference queue.
|
T |
get()
Returns the object, this reference refers to.
|
boolean |
isEnqueued()
Tells if the object is enqueued on a reference queue.
|
public T get()
public void clear()
public boolean isEnqueued()
public boolean enqueue()