Check out example codes for "create a map from list kotlin". It will help you in understanding the concepts better.

Code Example 1

fun main() {
    val numbers = listOf("one", "two", "three", "four")

    println(numbers.associateBy { it.first().toUpperCase() })
    println(numbers.associateBy(keySelector = { it.first().toUpperCase() }, valueTransform = { it.length }))
}

Learn ReactJs, React Native from akashmittal.com