A map is a collection that stores key-value pairs. It's used for paired data like username and age, product id and price, or setting name and setting value. Since you can look up a value using its key, lookups are fast and the code stays readable.
kotlin
fun main() {
val ageMap = mapOf(
"Alice" to 30,
"Bob" to 25
)
println("Alice's age is ${ageMap["Alice"]}")
}You should see
Alice's age is 30Summary
A map is a clean, practical collection for key-value data.