value

val value: T

The current value, computing and caching it when absent.

Returns the cached instance while it is alive; otherwise runs the initializer, caches the fresh instance weakly, and returns it. Hold the returned value in a local while using it, because reading value twice may compute twice once the first instance becomes unreachable.