stdlib: Introduced Array<T>?.orEmpty() in JVM-stdlib
This commit is contained in:
committed by
Andrey Breslav
parent
73ca75cc0b
commit
da5164acd8
@@ -35,3 +35,6 @@ public fun ByteArray.toString(charset: Charset): String = String(this, charset)
|
||||
|
||||
[Intrinsic("kotlin.collections.copyToArray")] public fun <reified T> Collection<T>.copyToArray(): Array<T> =
|
||||
throw UnsupportedOperationException()
|
||||
|
||||
/** Returns the List if its not null otherwise returns the empty list */
|
||||
public inline fun <reified T> Array<T>?.orEmpty(): Array<T> = this ?: array<T>()
|
||||
|
||||
Reference in New Issue
Block a user