Update coroutine related runtime parts
This commit is contained in:
committed by
Stanislav Erokhin
parent
852a5ee064
commit
72401efb9f
@@ -78,6 +78,9 @@ fun <T1, T2> Pair<T1, T2>.swap(): Pair<T2, T1> = Pair(second, first)
|
||||
|
||||
fun <T: Any> T.check(predicate: (T) -> Boolean): T? = if (predicate(this)) this else null
|
||||
|
||||
inline fun <reified T : Any> Any?.safeAs(): T? = this as? T
|
||||
inline fun <reified T : Any> Any?.cast(): T = this as T
|
||||
|
||||
fun <T : Any> constant(calculator: () -> T): T {
|
||||
val cached = constantMap[calculator]
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@@ -124,4 +127,4 @@ inline fun <T> Iterable<T>.sumByLong(selector: (T) -> Long): Long {
|
||||
|
||||
inline fun <T, C : Collection<T>, O> C.ifNotEmpty(body: C.() -> O?): O? = if (isNotEmpty()) this.body() else null
|
||||
|
||||
inline fun <T, O> Array<out T>.ifNotEmpty(body: Array<out T>.() -> O?): O? = if (isNotEmpty()) this.body() else null
|
||||
inline fun <T, O> Array<out T>.ifNotEmpty(body: Array<out T>.() -> O?): O? = if (isNotEmpty()) this.body() else null
|
||||
|
||||
Reference in New Issue
Block a user