A property like `val isEmpty get() = this.size == ...
# getting-started
h
A property like
val 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