is there another way I get a `CharArray` from an `...
# announcements
e
is there another way I get a
CharArray
from an
IntArray
other than
.let{ ints -> CharArray(ints.size){ints[it].toChar()}
?
b
how about
Copy code
(1..100).map { it.toChar() }
//or
(1..100).map(Int::toChar)
e
I do start from an
intArrayOf(..)
b
yeah,my bad
Copy code
intArrayOf(1,2,3).map { it.toChar() }.toCharArray()
👍 1
d
Note that that will box all chars into an object and create a list. Only to then unbox all of them again to copy them into an array.
👍 2
☝️ 1
e
yeah, I imagined that, however it's one time (lazy) initialization
j
on jvm you can use ByteBuffer to stay all in primitives.