public class WeakKeyReference<T> extends WeakReference<T>
equals method will compare itself to another
WeakKeyReference, or to another object that is then
compared to the key held by this reference.
This class is public so that it can be used in other tables for
which WeakTable won't work.
| Constructor and Description |
|---|
WeakKeyReference(T key)
Create a new
WeakReference to the given key. |
WeakKeyReference(T key,
ReferenceQueue<T> refQueue)
Create a new
WeakReference to the given key, placing
the cleared reference on the specified ReferenceQueue. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other)
Equivalence for WeakKeyReference is defined as follows:
If the other reference is to this object, return
true. |
int |
hashCode()
Return the key's hashCode remembered from the time of reference
creation.
|
clear, enqueue, get, isEnqueuedpublic WeakKeyReference(T key)
WeakReference to the given key. The
reference is placed on no queue.public WeakKeyReference(T key, ReferenceQueue<T> refQueue)
WeakReference to the given key, placing
the cleared reference on the specified ReferenceQueue.public int hashCode()
WeakKeyReference for that new table.public boolean equals(Object other)
true.
false.
false if the other's key is cleared; otherwise return
the result of invoking equals on the two keys.
Copyright © 2016–2018. All rights reserved.