Refactor: use new functions in stdlib code

This commit is contained in:
Ilya Gorbunov
2017-01-14 08:02:58 +03:00
parent 1ae56c374f
commit 914c55b57f
3 changed files with 4 additions and 5 deletions
@@ -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)
}