Transform *Array.size to properties
This commit is contained in:
@@ -4,7 +4,7 @@ public inline fun <reified T> Array(n: Int, block: (Int) -> T): Array<T> = null!
|
||||
// KT-312 Nullability problem when a nullable version of a generic type is returned
|
||||
|
||||
fun <T> Array<out T>.safeGet(index : Int) : T? {
|
||||
return if (index < size()) this[index] else null
|
||||
return if (index < size) this[index] else null
|
||||
}
|
||||
|
||||
val args : Array<String> = Array<String>(1, {""})
|
||||
|
||||
@@ -17,6 +17,6 @@ fun main() {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Array<T>.lastIndex() = size() - 1
|
||||
val <T> Array<T>.lastIndex : Int get() = size() - 1
|
||||
fun <T> Array<T>.lastIndex() = size - 1
|
||||
val <T> Array<T>.lastIndex : Int get() = size - 1
|
||||
val <T> Array<T>.indices : IntRange get() = IntRange(0, lastIndex)
|
||||
|
||||
Reference in New Issue
Block a user