Each time we create a model class, we end up writing the same boilerplate code for:
- Constructor
- Getter-Setter (s)
- hashCode()
- equals()
- toString()
Kotlin introduced the data keyword where the compiler automatically derives the following stuff based upon the parameters of the primary constructor:
- Getter-Setter (s), which are not technically due to data keywords
- equals()/hashCode() pair
- toString()
- componentN() functions corresponding to the properties in their order of declaration
- copy() function
It saves a lot of boilerplate code and makes the model classes look clean and concise.
The Message class is the data structure representing the messages left by a user on the map. It holds the actual message left, the author of the ...