What's the Kotlin equivalent of Java's String[]?

后端 未结 8 1227
感情败类
感情败类 2020-12-23 08:26

I see that Kotlin has ByteArray, ShortArray, IntArray, CharArray, DoubleArray, FloatArray, which are equivalent to byte[], short[], int[],char[], double[]

8条回答
  •  悲哀的现实
    2020-12-23 09:07

    For Strings and other types, you just use Array<*>. The reason IntArray and others exist is to prevent autoboxing.

    So int[] relates to IntArray where Integer[] relates to Array.

提交回复
热议问题