December 2017
Intermediate to advanced
260 pages
7h 34m
English
The data class is one of the most popular features among Kotlin developers. It is similar to the concept of the Model class.
The compiler automatically derives the following members from all properties declared in the primary constructor:
A simple version of the data class can look like the following line of code, where name and age will become properties of a class:
data class User(val name: String, val age: Int)
With this single line and, mainly, with the data keyword, you get equals()/hasCode(), toString() and the benefits ...
Read now
Unlock full access