August 2018
Beginner
178 pages
4h 56m
English
We wrote a version of a lazily initialized property in the previous section. The standard library has a better version of a delegate property for delaying object creation. An instance of the lazy interface is produced with the lazy function:
val str by lazy { "I'm lazily initialized" }
The lazy function can accept also a LazyThreadSafetyMode enum, which has three values:
Read now
Unlock full access