https://kotlinlang.org logo
#getting-started
Title
# getting-started
s

Sudhir Singh Khanger

12/29/2020, 4:05 AM
Is the following statement correct?
In Java, arrays store primitive types whereas collections store boxed types. In Kotlin, both arrays and collections store boxed type whereas one can use classes like
IntArray
,
ByteArray
, etc. to store primitive data type without boxing.
e

ephemient

12/29/2020, 4:35 AM
Java has both boxed and primitive arrays
primitive collections can exist too - e.g. the ones provided by Eclipse Collections for Java - but they're not built in
n

nanodeath

12/29/2020, 4:48 PM
Kotlin has IntArray (unboxed) and Array<Int> (boxed) Java as int[] (unboxed) and Integer[] (boxed). collections in both languages are always boxed.
2 Views