I'm very new to Groovy but I couldn't find an answer to my question over web.
I've a very simple map: Map<String, Object>
. I need to update values of this map using a method while iterating. I've found a way to do it:
Map<String, Object> newMap = myMap.each { it -> it.value = getValue(it.key) }
I couldn't understand why this doesn't work:
Map<String, Object> newMap = myMap.each { k,v -> v = getValue(k) }
Thanks in advance.