Initialize property in Kotlin so that the code is executed only once

前端 未结 0 1619
野性不改
野性不改 2020-12-14 20:49

I would like to know if there is a more idiomatic way of writing the following in Kotlin:

val lazyValue: Unit by lazy {
    println("computed!")
            


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题