How to remove element from a map in Groovy

1 Answer

0 votes
def map = [name: "Groovy", age: 13, country: "United States", city: "New York"]

map = map.minus([city: "New York"]);

map.each{key, value -> println "${key}:${value}"}

 
 
 
/*
run:
 
name:Groovy
age:13
country:United States
 
*/

 



answered Oct 4, 2020 by avibootz

Related questions

1 answer 277 views
1 answer 256 views
1 answer 282 views
1 answer 297 views
1 answer 259 views
1 answer 301 views
301 views asked Oct 5, 2020 by avibootz
...