Provide a way to construct an empty typed array without init lambda.

This commit is contained in:
Ilya Gorbunov
2015-04-23 14:31:47 +03:00
parent 31b9ee65e0
commit 34526005d0
2 changed files with 5 additions and 1 deletions
@@ -13,3 +13,7 @@ public inline fun <reified T> Array(size: Int, init: (Int) -> T): Array<T> {
return result as Array<T>
}
// Returns an empty array of the specified type `T`.
public inline fun <reified T> emptyArray(): Array<T> = arrayOfNulls<T>(0) as Array<T>