Is there a good resource for understanding the usa...
# announcements
h
Is there a good resource for understanding the usage differences between
List
and
Array
in Kotlin? Or
Array<Double>
and
DoubleArray
? Meaning when should you use one or the other, not what they literally are in terms of blocks of memory or the like.
l
Array<Double>
is
Double[]
and
DoubleArray
is
double[]
. Prefer the latter whenever possible (i.e. not working with generics). Also generally speaking, only use
Array
instead of
List
for performance sensitive code.
👍 1
r
When it comes to list vs array, the general rule of thumb is to use a list unless you need an array. If you don't know if you need an array, you likely don't.
👍 2