WeakReference

Native
1.3
class WeakReference<T : Any>

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 destoyed 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)

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?