def list = [1,2,3] def sum = list.inject(0) { sum, item -> sum + item }

The value of sum will be 6.