"# KotlinMapFromSring"
raydel8806 / kotlinmapfromsring Goto Github PK
View Code? Open in Web Editor NEWThis is the easiest method I have found to get a map from a text string. Kotlin map is a collection which contains pairs of objects. Map holds the data in the form of pairs which consists of a key and a value. Map keys are unique and the map holds only one value for each key. Kotlin distinguishes between immutable and mutable maps. Immutable maps created with mapOf() means these are read-only and and mutable maps created with mutableMapOf() means we can perform read and write both. Syntax : fun <K, V> mapOf(vararg pairs: Pair<K, V>): Map<K, V> The first value of the pair is the key and the second is the value of the corresponding key . If multiple pair have same key then map will return the last pair value. The map entries is traversed in the specified order.