Реализации на Kotlin

Prototype

Общая реализация на языке Kotlin

data class Candy(
    val name: String,
    val taste: String,
    val manufacture: String
)
fun main() {
    val myCandy = Candy("Mishka","delicious", "Noname")
    val sistersCandy = myCandy.copy()

    println("Is candies equals: ${myCandy == sistersCandy}")
    println("My candy: ${System.identityHashCode(myCandy)}")
    println("Sisters candy: ${System.identityHashCode(sistersCandy)}")
}

Last updated

Was this helpful?