WeakReference

open class WeakReference<T> : Reference<T?>

Inheritors

Constructors

Link copied to clipboard
constructor(referent: T?)

Creates a new weak reference that refers to the given object. The new reference is not registered with any queue.

constructor(referent: T?, q: ReferenceQueue<T?>?)

Creates a new weak reference that refers to the given object and is registered with the given queue.

Properties

Link copied to clipboard
open var queue: ReferenceQueue<T?>?

Functions

Link copied to clipboard
open fun clear()

Clears this reference. The default implementation simply clears the referent.

Link copied to clipboard
open fun enqueue(): Boolean

Clears this reference and enqueues it in its associated ReferenceQueue, if any.

Link copied to clipboard
open fun get(): T?

Returns the referent or null if it has been cleared.

Link copied to clipboard
open fun refersTo(obj: T?): Boolean

Checks whether the referent equals the given obj.