Use emptyArray in orEmpty.

This commit is contained in:
Ilya Gorbunov
2016-12-24 02:03:48 +03:00
parent 05dcaccf09
commit 9619e08c9b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ package kotlin.collections
import kotlin.comparisons.naturalOrder
/** Returns the array if it's not `null`, or an empty array otherwise. */
public inline fun <T> Array<out T>?.orEmpty(): Array<out T> = this ?: arrayOf<T>()
public inline fun <T> Array<out T>?.orEmpty(): Array<out T> = this ?: emptyArray<T>()
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
public inline fun <T> Collection<T>.toTypedArray(): Array<T> = copyToArray(this)
@@ -24,7 +24,7 @@ import java.nio.charset.Charset
/** Returns the array if it's not `null`, or an empty array otherwise. */
public inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = this ?: arrayOf<T>()
public inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = this ?: emptyArray<T>()
/**
* Converts the contents of this byte array to a string using the specified [charset].