Logo

Programming-Idioms

History of Idiom 8 > diff from v68 to v69

Edit summary for version 69 by hover:
[Kotlin] add comment

Version 68

2020-04-29, 09:20:40

Version 69

2020-04-29, 09:23:01

Idiom #8 Initialize a new map (associative array)

Declare a new map object x, and provide some (key, value) pairs as initial content.

Idiom #8 Initialize a new map (associative array)

Declare a new map object x, and provide some (key, value) pairs as initial content.

Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
val x = mapOf("one" to 1, "two" to 2)
Code
val x = mapOf("one" to 1, "two" to 2)
Comments bubble
use it only if performance isn't critical, see docs
Doc URL
https://kotlinlang.org/docs/reference/constructing-collections.html
Doc URL
https://kotlinlang.org/docs/reference/constructing-collections.html