Equals method for data class in Kotlin
In Kotlin data classes equality check, arrays, just like other classes, are compared using equals(…), which compares the arrays references, not the content. This behavior is described here: So, whenever you say arr1 == arr2 DataClass(arr1) == DataClass(arr2) … you get the arrays compared through equals(), i.e. referentially. Given that, val arr1 = intArrayOf(1, 2, … Read more