When using delegation - should I use a function or a property?


#1

If I have a class that delegates some work to another class, does it matter if I use a function:

fun isEmpty() = delegatee.isEmpty()

or a property

val isEmpty
  get() = delegatee.isEmpty()

?

Thank you – Randy


#2

No, it does not matter. Also, consider Kotlin's built-in capability for delegation.