In the last recipe, we learned how to use data class and how it reduces a lot of boilerplate code. In this recipe, we will see how data class makes it easy to copy another data class, even if you have to modify the property.
A brute-force mechanism to copy a data class can be to just create a data class by duplicating all the properties, but using the copy method will make it much easier.