nonNullableReference

fun <T : Any> nonNullableReference(initValue: T? = null): ReadWriteProperty<Any?, T>

Creates a thread-safe delegate for a non-nullable property backed by an AtomicReference.

Reading the property before it has been set throws IllegalStateException.

Return

a ReadWriteProperty delegate

Parameters

initValue

optional initial value (default null, meaning uninitialized)

Type Parameters

T

the property type