Using '*:map' notation, we can spread the map elements.
HelloWorld.groovy
def africaCountries = ["Angola" : "Luanda", "Egypt" : "Cairo"] def asiaCountries = ["India" : "new Delhi", "China" : "Beijing"] def allCountries = ["Germany" : "Berlin", *:africaCountries, *:asiaCountries] print allCountries
Output
[Germany:Berlin, Angola:Luanda, Egypt:Cairo, India:new
Delhi, China:Beijing]
No comments:
Post a Comment