Implemented asIterable method for arrays. #KT-1313 Fixed

This commit is contained in:
Valery Kharitonov
2015-01-04 12:26:01 +03:00
committed by Ilya Ryzhenkov
parent 3954215b50
commit 38a4f86db2
3 changed files with 121 additions and 2 deletions
@@ -23,6 +23,19 @@ fun arrays(): List<GenericFunction> {
}
}
templates add f("asIterable()") {
only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns the Iterable that wraps the original array" }
returns("Iterable<T>")
body {
"""
return object : Iterable<T> {
override fun iterator(): Iterator<T> = this@asIterable.iterator()
}
"""
}
}
templates add pval("lastIndex") {
only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns the last valid index for the array" }
@@ -42,4 +55,4 @@ fun arrays(): List<GenericFunction> {
}
return templates
}
}