Data classes in Kotlin

GPTKB entity

Statements (31)
Predicate Object
gptkbp:instanceOf Kotlin language feature
gptkbp:defaultMethods toString()
equals()
hashCode()
copy()
componentN()
gptkbp:documentation https://kotlinlang.org/docs/data-classes.html
gptkbp:feature automatic equals() implementation
automatic hashCode() implementation
automatic toString() implementation
componentN() functions
copy() function
gptkbp:hasSyntax data class User(val name: String, val age: Int)
https://www.w3.org/2000/01/rdf-schema#label Data classes in Kotlin
gptkbp:introducedIn gptkb:Kotlin_1.0
gptkbp:limitation cannot be abstract
cannot be inner
cannot be open
cannot be sealed
gptkbp:purpose to hold data
gptkbp:requires must have at least one primary constructor parameter
primary constructor parameters must be val or var
gptkbp:supportedBy gptkb:JVM
gptkb:JS
Native
gptkbp:supportedSince gptkb:Kotlin_1.0
gptkbp:uses value objects
DTOs (Data Transfer Objects)
modeling immutable data
gptkbp:bfsParent gptkb:Records_(since_Java_16)
gptkbp:bfsLayer 8