I am curious (quite new to closure). How do groovy closure knows that it should map parameter animal to the testMap's key and parameter animalSound to testMap's value?
def testMap = ['cat':'Meow', 'dog':'Woof'] testMap.each { animal, animalSound -> println "${animal} has the sound ${animalSound}" };