horse_badorties
08/03/2017, 7:44 AMval isEmpty get() = this.size == 0 does not allocate a Boolean for each class instance, because there will be no backing field. It's merely a fun that comes as a property and is equivalent to fun isEmpty() = this.size == 0.
val isEmpty = this.size == 0 on the other hand would allocate a Boolean.
Did I get that right? 🤔
https://kotlinlang.org/docs/reference/properties.html#backing-fields