Groovy Inline Closures
Consider the following closure sum and it's use in inject method.
def numbers = [1, 2, 3, 4, 5, 6, 7]
def sum = { number1, number2 ->
number1 + number2
}
println numbers.inject(0, sum) // 28
If you are not familiar with Groovy closures, this post has the details.
In