simon.vergauwen
12/23/2018, 12:53 PMfun tests(start: Int, end: Int): IntArray =
(start until end).toList().toIntArray()
Hexa
12/23/2018, 12:55 PMList
first and then Array
? Isn't that expensive?simon.vergauwen
12/23/2018, 12:58 PMScala
they have a special system with implicit classes which makes it more flexible.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 IntRange
to convert toIntArray
directly.Hexa
12/23/2018, 1:20 PMsimon.vergauwen
12/23/2018, 1:22 PM