lazy

expect fun <T> lazy(initializer: () -> T): Lazy<T>(source)

Since Kotlin

1.0

expect fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer.

The mode parameter is ignored.

Since Kotlin

1.0

expect fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer.

The lock parameter is ignored.

Since Kotlin

1.0
actual fun <T> lazy(initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer.

Since Kotlin

1.1

actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer.

The mode parameter is ignored.

Since Kotlin

1.1

actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer.

The lock parameter is ignored.

Since Kotlin

1.1
actual fun <T> lazy(initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer and the default thread-safety mode LazyThreadSafetyMode.SYNCHRONIZED.

If the initialization of a value throws an exception, it will attempt to reinitialize the value at next access.

Note that the returned instance uses itself to synchronize on. Do not synchronize from external code on the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.

Since Kotlin

1.0

actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer and thread-safety mode.

If the initialization of a value throws an exception, it will attempt to reinitialize the value at next access.

Note that when the LazyThreadSafetyMode.SYNCHRONIZED mode is specified the returned instance uses itself to synchronize on. Do not synchronize from external code on the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.

Since Kotlin

1.0

actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer and the default thread-safety mode LazyThreadSafetyMode.SYNCHRONIZED.

If the initialization of a value throws an exception, it will attempt to reinitialize the value at next access.

The returned instance uses the specified lock object to synchronize on. When the lock is not specified the instance uses itself to synchronize on, in this case do not synchronize from external code on the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.

Since Kotlin

1.0
actual fun <T> lazy(initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer and the default thread-safety mode LazyThreadSafetyMode.SYNCHRONIZED.

If the initialization of a value throws an exception, it will attempt to reinitialize the value at next access.

Note that the returned instance uses itself to synchronize on. Do not synchronize from external code on the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.

Since Kotlin

1.3

actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer and thread-safety mode.

If the initialization of a value throws an exception, it will attempt to reinitialize the value at next access.

Note that when the LazyThreadSafetyMode.SYNCHRONIZED mode is specified the returned instance uses itself to synchronize on. Do not synchronize from external code on the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.

Since Kotlin

1.3

actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T>(source)

Creates a new instance of the Lazy that uses the specified initialization function initializer and the default thread-safety mode LazyThreadSafetyMode.SYNCHRONIZED.

If the initialization of a value throws an exception, it will attempt to reinitialize the value at next access.

The returned instance uses the specified lock object to synchronize on. When the lock is not specified the instance uses itself to synchronize on, in this case do not synchronize from external code on the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.

Since Kotlin

1.3