Kotlin equals gives true even if object parameters have different values


#1

Ex :

data class A(val id: String, personName: PersonName) {

}

data class PersonName(name: String) {
}

val objA = A(“1”, PersonName(“A”))
val objB = objA.copy(personName = objA.personName.copy(name = “B”))

objA == objB (or) objA.equals(objB) gives True when it should be False


#2

Sorry it was a bug in my code. Pls delete this post.