W3cubDocs

/Kotlin

Lazy

interface Lazy<out T>

Represents a value with lazy initialization.

To create an instance of Lazy use the lazy function.

Properties

value

abstract val value: T

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.

Functions

isInitialized

abstract fun isInitialized(): Boolean

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.

Inherited Functions

equals

open operator fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:

hashCode

open fun hashCode(): Int

Returns a hash code value for the object. The general contract of hashCode is:

toString

open fun toString(): String

Returns a string representation of the object.

Extension Functions

getValue

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

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

© 2010–2018 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-lazy/index.html