Lazy

Common
JVM
JS
Native
1.0
interface Lazy<out T>
(source)

Represents a value with lazy initialization.

To create an instance of Lazy use the lazy function.

Properties

Common
JVM
JS
Native
1.0

value

Gets the lazily initialized value of the current Lazy instance. Once the value was initialized it must not change during the rest of lifetime of this Lazy instance.

abstract val value: T

Functions

Common
JVM
JS
Native
1.0

isInitialized

Returns true if a value for this Lazy instance has been already initialized, and false otherwise. Once this function has returned true it stays true for the rest of lifetime of this Lazy instance.

abstract fun isInitialized(): Boolean

Extension Functions

Common
JVM
JS
Native
1.0

getValue

An extension to delegate a read-only property of type T to an instance of Lazy.

operator fun <T> Lazy<T>.getValue(
    thisRef: Any?,
    property: KProperty<*>
): T