Arrays of Primitives

suggest change

These types do not inherit from Array<T> to avoid boxing, however, they have the same attributes and methods.

Kotlin type Factory function JVM type
BooleanArray booleanArrayOf(true, false) boolean[]
ByteArray byteArrayOf(1, 2, 3) byte[]
CharArray charArrayOf('a', 'b', 'c') char[]
DoubleArray doubleArrayOf(1.2, 5.0) double[]
FloatArray floatArrayOf(1.2, 5.0) float[]
IntArray intArrayOf(1, 2, 3) int[]
LongArray longArrayOf(1, 2, 3) long[]
ShortArray shortArrayOf(1, 2, 3) short[]

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents