A data
class is a class that mostly serves as a container for some data,
represented by properties in the constructor.
Kotlin automatically generates a lot of methods for a data
class, including:
a
toString()
method that shows all of the constructor propertiesan
equals()
method that uses the constructor properties to determine if two instances of the class are equala
copy()
method that makes it easy to create a new instance of the class by copying the values of another instance and overriding them selectively
You can learn more about this in:
Tags: