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 destroyed by the memory manager.
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)
Returns either reference to an object or null, if it was collected.
val value: T?
Clears reference to an object.
fun clear()
Returns either reference to an object or null, if it was collected.
fun get(): T?
© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.ref/-weak-reference/index.html