Learn
Maps
Introduction to Maps

The final collection we’ll cover in this section is a map. A map consists of a group of key-value pairs where each key corresponds to a single value. A key-value pair is referred to as an entry and resembles two connected pieces of data where a key is a unique identifier, and the value represents its corresponding data.

Maps are applicable in a variety of programming scenarios and their syntax resembles that of real data from the web. Take a look at the image on the right. The legend is in the form of a Kotlin map, and it provides information about the type of animals the journeyer should expect to encounter and watch out for in their path.

The name of each place is in the form of a key, and each corresponding animal is the value. Notice how data in a Kotlin map is enclosed within curly braces as opposed to square brackets for lists and sets.

In this lesson, we’ll explore other unique characteristics of the map collection as well as how to declare a map and utilize its various built-in operations.

Instructions

When you’re ready to move on, click Next to learn more about the map collection in Kotlin.

Folder Icon

Take this course for free

Already have an account?