In kotlin we can use both of these approach lazy{}
and getter()
lazy initializaiton:
internal val connector by lazy {
serviceConnector
}
getter():
internal val connector : ServiceConnector
get() = serviceConnector
When to use which approach and what actually does these two approach under the hood. Which one is best approach?