Delegation allows deferring the initialization of a variable at a later stage instead of initializing the variable as
null. It helps to initialize the variable only once.
Fortunately, Kotlin comes with native support for Delegation with 2 standard delegates (part of the Kotlin standard library) via
lateinit. This is extremely handy and useful feature, as we don’t need to initialize something until it is required; or just because we can’t initialize something until we have all we need.
In this lesson you will learn:
- How the
lazy function work
- How values are only computed once
- About the various