Implemented asIterable method for arrays. #KT-1313 Fixed
This commit is contained in:
committed by
Ilya Ryzhenkov
parent
3954215b50
commit
38a4f86db2
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user