January 2018
Intermediate to advanced
434 pages
14h 1m
English
If you have worked with Java, you probably know what a getter-setter is. Java has fields and getter-setters are the methods that are used to access (getter) and modify (setter) member variables. They are an essential part of encapsulation (one of the design principles).
However, in Kotlin, we don't have any fields, but we have properties instead. A property can have a custom implementation of an accessor and a mutator. In this recipe, we will see how we can implement custom accessors and mutators.
Read now
Unlock full access