Guys quick question... is data class with custom e...
# announcements
d
Guys quick question... is data class with custom equals possible in Kotlin?
Copy code
data class AnswerViewModel(val id: Long, val title: String, val isCorrect: Boolean) {


    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is AnswerViewModel) return false

        if (id != other.id) return false

        return true
    }

    override fun hashCode(): Int {
        return id.hashCode()
    }

}