Sudhir Singh Khanger10/15/2019, 5:31 AM
which is a
which preserves the insertion order unlike
. In Java/Android, if one is used to using
then I would think I can continue using
in Kotlin. Is that correct?
diesieben0710/15/2019, 7:03 AM
, which extends
Sudhir Singh Khanger10/15/2019, 8:48 AM
. Although I don't think I need to maintain order but I might as well use it.
diesieben0710/15/2019, 8:56 AM
karelpeeters10/15/2019, 8:58 AM
is the default, now everybody is paying this cost all over the code and you need to actively think about using
eekboom10/15/2019, 9:25 AM
Sudhir Singh Khanger10/16/2019, 4:19 PM
linkedMapOf(1 to "z")
? Or is
mapOf(1 to "z")
a Java class whereas
is Kotlin class, if there is such a thing, and by extension I should use Kotlin specific classes where ever possible.
karelpeeters10/16/2019, 4:23 PM
always returns a
returns different types for an empty map. Also ´linkedMapOf` is mutable.
to emphasize that the order matters because
clearly doesn't signal that.
Sudhir Singh Khanger10/16/2019, 4:41 PM
What do you mean by different types?returns different types for an empty map.
karelpeeters10/16/2019, 4:44 PM
println(mapOf<String, Int>()::class) println(mapOf<String, Int>("a" to 0)::class) println(mapOf<String, Int>("a" to 0, "b" to 1)::class) println(mapOf<String, Int>("a" to 0, "b" to 1, "c" to 2)::class) //prints: //kotlin.collections.EmptyMap //java.util.Collections$SingletonMap //java.util.LinkedHashMap //java.util.LinkedHashMap