Refactor: use new functions in stdlib code
This commit is contained in:
@@ -153,8 +153,8 @@ internal class InternalHashCodeMap<K, V>(override val equality: EqualityComparat
|
||||
}
|
||||
|
||||
private fun getChainOrNull(hashCode: Int): Array<MutableEntry<K, V>>? {
|
||||
val chain = backingMap[hashCode]
|
||||
return if (chain !== undefined) chain else null // satisfying { it != undefined }
|
||||
val chain = backingMap[hashCode].unsafeCast<Array<MutableEntry<K, V>>?>()
|
||||
return chain.takeIf { it !== undefined }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ public open class LinkedHashMap<K, V> : HashMap<K, V>, Map<K, V> {
|
||||
|
||||
val current = next!!
|
||||
last = current
|
||||
next = current.next
|
||||
if (next === head) next = null // satisfying { it != head }
|
||||
next = current.next.takeIf { it !== head }
|
||||
return current
|
||||
}
|
||||
|
||||
|
||||
@@ -44,5 +44,5 @@ public fun thread(start: Boolean = true, isDaemon: Boolean = false, contextClass
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T: Any> ThreadLocal<T>.getOrSet(default: () -> T): T {
|
||||
return get() ?: default().apply { set(this) }
|
||||
return get() ?: default().also(this::set)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user