Browse topics
Object Oriented Kotlin
Data Classes
Data class declaration, copy, destructuring and equals/hashCode.
kotlin data classesData Class Declaration in KotlinData classes are designed to hold data. A Kotlin example with source code and sample output.kotlin data classesData Class copy in Kotlincopy() creates a new object with selected changed properties. A Kotlin example with source code and sample output.kotlin data classesData Class Destructuring in KotlinDestructuring splits a data class into component variables. A Kotlin example with source code and sample output.kotlin data classesData Class equals and hashCode in KotlinData classes compare values using equals instead of reference. A Kotlin example with source code and sample output.
Related topics
Kotlin Classes Declare classes, properties, constructors and init blocks. Inheritance Open classes, overriding, abstract classes and inheritance rules. Interfaces Define and implement interfaces, functional interfaces and properties. Objects & Enums Object declarations, companion objects, expressions and enum classes. Sealed Classes Sealed classes, when expressions and restricted type hierarchies.