October 2018
Intermediate to advanced
370 pages
9h 15m
English
The term singleton refers to a class that contains only one instance during the application life cycle. This instance is globally available for all functions and classes. Compared to Java or other programming languages, Kotlin provides an easier way to create a singleton class using the object keyword:
object singletonClassName { properties fun function(){ function body } }
The singleton class is similar to other normal classes; it contains properties and functions and can implement interfaces. However, there are a few things that make this class unique:
Let's take an ...
Read now
Unlock full access