Nullable Array.contentEquals/contentHashCode/contentToString #KT-34161
This commit is contained in:
@@ -72,9 +72,9 @@ public inline fun <C, R> C.ifEmpty(defaultValue: () -> R): R where C : Array<*>,
|
||||
@PublishedApi
|
||||
@kotlin.jvm.JvmName("contentDeepEquals")
|
||||
@kotlin.js.JsName("contentDeepEqualsImpl")
|
||||
internal fun <T> Array<out T>.contentDeepEqualsImpl(other: Array<out T>): Boolean {
|
||||
internal fun <T> Array<out T>?.contentDeepEqualsImpl(other: Array<out T>?): Boolean {
|
||||
if (this === other) return true
|
||||
if (this.size != other.size) return false
|
||||
if (this == null || other == null || this.size != other.size) return false
|
||||
|
||||
for (i in indices) {
|
||||
val v1 = this[i]
|
||||
@@ -113,7 +113,8 @@ internal fun <T> Array<out T>.contentDeepEqualsImpl(other: Array<out T>): Boolea
|
||||
@PublishedApi
|
||||
@kotlin.jvm.JvmName("contentDeepToString")
|
||||
@kotlin.js.JsName("contentDeepToStringImpl")
|
||||
internal fun <T> Array<out T>.contentDeepToStringImpl(): String {
|
||||
internal fun <T> Array<out T>?.contentDeepToStringImpl(): String {
|
||||
if (this == null) return "null"
|
||||
val length = size.coerceAtMost((Int.MAX_VALUE - 2) / 5) * 5 + 2 // in order not to overflow Int.MAX_VALUE
|
||||
return buildString(length) {
|
||||
contentDeepToStringInternal(this, mutableListOf())
|
||||
|
||||
Reference in New Issue
Block a user