Use emptyArray in orEmpty.
This commit is contained in:
@@ -19,7 +19,7 @@ package kotlin.collections
|
|||||||
import kotlin.comparisons.naturalOrder
|
import kotlin.comparisons.naturalOrder
|
||||||
|
|
||||||
/** Returns the array if it's not `null`, or an empty array otherwise. */
|
/** 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")
|
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||||
public inline fun <T> Collection<T>.toTypedArray(): Array<T> = copyToArray(this)
|
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. */
|
/** 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].
|
* Converts the contents of this byte array to a string using the specified [charset].
|
||||||
|
|||||||
Reference in New Issue
Block a user