Groovy Functional Programming - Collect
Functional programming languages provide a map higher order function, which produces a new collection by applying the specified function on each element of the collection on which the map operation is invoked. Groovy uses collect instead of map.
Consider the following list of numbers.
def numbers = [1, 2, 3, 4]