orEmpty() for Array<T> fixed

This commit is contained in:
Andrey Breslav
2012-10-09 18:44:56 +04:00
parent 6f7b6e4ff3
commit c0af93f237
+1 -1
View File
@@ -7,7 +7,7 @@ public inline fun <T> Array<T>.notEmpty() : Boolean = !this.isEmpty()
public inline fun <T> Array<T>.isEmpty() : Boolean = this.size == 0
/** Returns the array if its not null or else returns an empty array */
public inline fun <T> Array<T>?.orEmpty() : Array<T> = if (this != null) this else array<T>()
public inline fun <T> Array<out T>?.orEmpty() : Array<out T> = if (this != null) this else array<T>()
public inline val BooleanArray.lastIndex : Int
get() = this.size - 1