public static <T> Object sum(Iterator<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) {
        return sum(self, null, closure, true);
    }
public static < T > Object sum ( Iterator < T > self , @ ClosureParams ( FirstParam . FirstGenericType . class ) Closure closure ) { return sum ( self , null , closure , true ) ; }
Sums the result of apply a closure to each item returned from an iterator.
<code>iter.sum(closure)</code> is equivalent to:
<code>iter.collect(closure).sum()</code>. The iterator will become
exhausted of elements after determining the sum value.

@param self    An Iterator
@param closure a single parameter closure that returns a numeric value.
@return The sum of the values returned by applying the closure to each
item from the Iterator.
@since 1.7.1