You can do:
val map = hashMapOf(
"John" to "Doe",
"Jane" to "Smith"
)
Here, to
is an infix function that creates a Pair
.
Or, more abstract: use mapOf()
like
val map = mapOf("a" to 1, "b" to 2, "c" to 3)
( found on kotlinlang )
You can do:
val map = hashMapOf(
"John" to "Doe",
"Jane" to "Smith"
)
Here, to
is an infix function that creates a Pair
.
Or, more abstract: use mapOf()
like
val map = mapOf("a" to 1, "b" to 2, "c" to 3)
( found on kotlinlang )