ValV
07/11/2019, 10:04 AMMutableList<String>
-> Array<String>
?Dias
07/11/2019, 10:05 AMValV
07/11/2019, 10:11 AMtoArray
... ?Dias
07/11/2019, 10:12 AMdiesieben07
07/11/2019, 10:14 AMCollection
has toArray
on the JVM which does something differentDias
07/11/2019, 10:14 AMValV
07/11/2019, 10:15 AMtoArray
in the place where toTypedArray
in Kotlin works. I'm confusedkarelpeeters
07/11/2019, 10:47 AMtoTypedArray
works using reified generics and for toArray
you need to create and pass the array yourself or live with an Array<Any>
.ValV
07/11/2019, 11:21 AM.toArray(new String[0])
gildor
07/11/2019, 12:12 PMval a = listOf(1)
a.toIntArray() // IntArray, extension only for List<Int>
a.toTypedArray() // ArrayInt, extension for List<T>
Collection’s toArray
is not a problem, because List is not implementing Java Collection in source code (but does on bytecode), so there is no name conflict