[K/N] Reorder hashCode, toString, equals in data classes to match K1 order

^KT-60247 Fixed

Merge-request: KT-MR-11080
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2023-07-18 00:06:48 +00:00
committed by Space Team
parent a4a0da267e
commit f9df4e1487
81 changed files with 890 additions and 4135 deletions
+14 -13
View File
@@ -295,6 +295,19 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
return Entry<T>(key = key, value = value)
}
override fun toString(): String {
return "Entry(" + "key=" + <this>.#key + ", " + "value=" + <this>.#value + ")"
}
override fun hashCode(): Int {
var result: Int = <this>.#key.hashCode()
result = result.times(other = 31).plus(other = when {
EQEQ(arg0 = <this>.#value, arg1 = null) -> 0
else -> <this>.#value.hashCode()
})
return result
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
@@ -312,19 +325,7 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
return true
}
override fun hashCode(): Int {
var result: Int = <this>.#key.hashCode()
result = result.times(other = 31).plus(other = when {
EQEQ(arg0 = <this>.#value, arg1 = null) -> 0
else -> <this>.#value.hashCode()
})
return result
}
override fun toString(): String {
return "Entry(" + "key=" + <this>.#key + ", " + "value=" + <this>.#value + ")"
}
}
}