dineshbob
07/01/2017, 5:02 AMvoddan
07/01/2017, 6:08 AMMutableList<String>(n, {""})
dineshbob
07/01/2017, 6:21 AMvoddan
07/01/2017, 7:27 AMjk
07/01/2017, 9:23 AMval list = ArrayList(size)
voddan
07/01/2017, 9:30 AMArrayList
jk
07/01/2017, 9:46 AMMutableList<String>(n, {""})
will work fine - @dineshbob it's just initialising the first n as "", you can still mutate it after initialisationdineshbob
07/01/2017, 11:52 AMMutableList<String>(n, {""}
then the List is initialized with empty strings. If we call add() to add the elements now, they are added after the empty strings. I see that's one big difference.ArrayList(size)
directly in the Kotlin world? I thought that's not advised in Kotlin.muhil
07/01/2017, 11:58 AMjk
07/01/2017, 11:59 AMdineshbob
07/01/2017, 12:05 PMjk
07/01/2017, 12:09 PMdineshbob
07/01/2017, 12:09 PMjk
07/01/2017, 12:10 PMdineshbob
07/01/2017, 12:15 PMvoddan
07/01/2017, 4:20 PMon JVM it doesn't implement MutableList?It does. The type hierarchy does not depend on the target platform. The types are mapped. Details: http://kotlinlang.org/docs/reference/java-interop.html#mapped-types