jean
private fun cookieStringToMap(string: String): Map<String, String> { val map = mutableMapOf<String, String>() string.split(";").forEach { entry -> val parts = entry.split("=") map[parts[0]] = parts[1] } return map }
bezrukov
private fun cookieStringToMap(string: String): Map<String, String> { return string.split(";").map { entry -> val (key, value) = entry.split("=") key to value }.toMap() }
Liudvikas Sablauskas
private fun cookieStringToMap(string: String) = string.split(";").associate { entry -> val (key, value) = entry.split("="); key to value }
associate
toMap
aleksey.tomin
private fun cookieStringToMap(string: String) = string.split(";") .map { it.split("=") } .associate { it[0] to it[1] }
gildor
christophsturm
"a=b;c=d".splitToSequence(";") .map { it.split("=") } .associate { it[0] to it[1] }
A modern programming language that makes developers happier.