Maps

Understand the map data structure, its use cases, and how to put it to use in Kotlin.

A map is a collection of keys associated with values. This is a concept you may also know as dictionaries (e.g., Python) or associative arrays (e.g., PHP). Each key is associated with one unique value. This value can have any type. In particular, it may be a collection, such as a list or a nested map.

Creating a Map #

Once again, Kotlin provides a convenient way to initialize (read-only) maps:

Get hands-on with 1000+ tech skills courses.