October 2018
Intermediate to advanced
370 pages
9h 15m
English
The mutable map supports adding and removing pairs, and provides a number of functions to update the existing collections. We can create a mutable map by using the mutableMapOf function:
val map : MutableMap<Int,String> = mutableMapOf ( Pair(1,"One"), Pair(1,"One"), Pair(2,"Two"), Pair(3,"Three"))
Take a look at the following diagram of the MutableMap interface:

The mutable map provides the following functions:
val result = map.put(4 ,"Four")
It returns null if the new pair is successfully inserted. Maps can't contain duplicate keys, so if the key already exists, ...
Read now
Unlock full access