hey channel. I need to iterate a map and create a ...
# spring
a
hey channel. I need to iterate a map and create a new map but with a transformation in the key. I will replace a value in the key based on the original key. I am trying to do in this way but the compile complains of
Copy code
fun pathMapped(): Map<String, String> = paths.entries.iterator()
    .forEach { entry -> return mapOf(entry.key.replace("__","/"), entry.value)}
could someone else here help to do implement this in a correct way?
k
Copy code
fun pathMapped(): Map<String, String> = paths.mapKeys { (k, v) -> k.repace("__","/") }
🦜 1
a
thank you very much @Klitos Kyriacou