fun tests(start: Int, end: Int): IntArray =
(start until end).toList().toIntArray()
h
Hexa
12/23/2018, 12:55 PM
thanks, so I have to convert it to a
List
first and then
Array
? Isn't that expensive?
s
simon.vergauwen
12/23/2018, 12:58 PM
Ye, it's how Kotlin collections work unfortunately. In
Scala
they have a special system with implicit classes which makes it more flexible.
simon.vergauwen
12/23/2018, 1:01 PM
toArray
is defined on
Collection
so only way to do it without writing any custom code is this. If you are worried about performance I would definitely write a custom extension method on