In the Kotlin interface, does it matter if properties are declared with an empty get / set statement?
For example...
interface ExampleInterface { // These... val a: String get var b: String get set // ...compared to these... val c: String var d: String }
Itβs hard for me to notice the difference.
When implementing the interface, it doesn't seem to matter if I use getters / seters for properties, or if I set the value directly.
When accessing these via java, val both have getters, and var have getters and seters.
public void javaMethod(ExampleInterface e) { e.getA(); e.getB(); e.setB(); e.getC(); e.getD(); e.setD(); }
properties getter-setter kotlin
Ben woodworth
source share