WeakReference

Native
1.3
class WeakReference<T : Any>
(source)

Class WeakReference encapsulates weak reference to an object, which could be used to either retrieve a strong reference to an object, or return null, if object was already destroyed by the memory manager.

Constructors

Native
1.3

<init>

Creates a weak reference object pointing to an object. Weak reference doesn't prevent removing object, and is nullified once object is collected.

WeakReference(referred: T)

Properties

Native
1.3

value

Returns either reference to an object or null, if it was collected.

val value: T?

Functions

Native
1.3

clear

Clears reference to an object.

fun clear()
Native
1.3

get

Returns either reference to an object or null, if it was collected.

fun get(): T?