We came across the term data class in Chapter 3, Object-Oriented Programming in Kotlin; however, we didn't go into much detail about what it could bring to the table. This chapter will cover the process of annotating classes, which will allow you to have boilerplate-free code. We will dig deep to see what the compiler does for us behind the scenes when we use a data class.
In this chapter, you will learn about the following:
- What destructuring is and how data classes are automatically eligible for destructuring operations
- How you get the copy, toString, hashCode, and equals methods implemented for you
- Rules to obey when defining data classes
- Limitations of data classes