interface SomeInterface {
fun getName(): String
}
interface SomeInterface {
val name: String
}
Which is recommended?
p
plinyar
02/01/2019, 6:44 AM
I would select first approach if it implies that getting a name is not a cheap operation, like it may access some external cache or perform complex calculation. If it is implied that a consumer may get a name as many times as it wants and it will not lead to performance degradation - I would only use the property approach, the second