Add quick fix to generate equals / hashcode in data class with arrays
So #KT-15893 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
5df5a001a1
commit
b9fb7cc3a5
+18
@@ -0,0 +1,18 @@
|
||||
import java.util.Arrays
|
||||
|
||||
data class A(val a: IntArray) {
|
||||
<caret>override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
|
||||
other as A
|
||||
|
||||
if (!Arrays.equals(a, other.a)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return Arrays.hashCode(a)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user