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 334 views
1 answer 159 views
1 answer 128 views
2 answers 146 views
1 answer 179 views
...