How to remove multiple elements 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", age: 13]);

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

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

 



answered Oct 4, 2020 by avibootz

Related questions

1 answer 413 views
1 answer 256 views
1 answer 218 views
2 answers 239 views
1 answer 304 views
1 answer 264 views
...