Lazy
Represents a value with lazy initialization.
To create an instance of Lazy use the lazy function.
Since Kotlin
1.0Samples
import kotlin.concurrent.thread fun main() { //sampleStart val answer: Int by lazy { println("Computing the answer to the Ultimate Question of Life, the Universe, and Everything") 42 } println("What is the answer?") // Will print 'Computing...' and then 42 println(answer) // 42 println("Come again?") // Will just print 42 println(answer) // 42 //sampleEnd }