Hullaballoonatic
11/09/2019, 5:01 AMByteArray
, IntArray
, CharArray
etc? why not just Array<Byte>
, Array<Int>
, Array<Char>
. I know that Java does treat primitive arrays differently from object arrays, but couldn't Kotlin do us a solid and smoosh them all into just Array<T>
?Derek Peirce
11/09/2019, 5:13 AMArray<Int>
sometimes means Integer[]
(when it's Array<T>
and learns of its type at runtime) and other times means int[]
.gildor
11/09/2019, 5:14 AMHullaballoonatic
11/09/2019, 7:18 AMint -> Int
and Integer -> Int
but not int[] -> IntArray
and Integer[] -> Array<Int>
?Derek Peirce
11/09/2019, 8:37 AMInt
refers to int
except when generics or nullability are involved, in which case it becomes Integer
. Converting between the two is trivial (relatively), so there's no issue. However, converting between int[]
and Integer[]
can be prohibitively expensive.gildor
11/09/2019, 9:31 AM