Does Array<Int> always translate to Integer[...
# getting-started
f
Does Array<Int> always translate to Integer[] on the JVM?
2
k
Yes, if you want
int[]
you have to use
IntArray
instead.
f
Thanks. Is it common to use IntArray?
r
Common in what sense? If it fits your need than you should use it
k
Well, it only exists on JVM. So the general approach would be
Array<Int>
. Downside is, you have to initialise it “manually”.
🚫 1
In most cases a mutable list is a good substitution for an array. Only in rather rare cases arrays are better in terms of the resulting code.
f
yea makes sense, thank you