public static <T> Object sum(T[] self, Object initialValue, @ClosureParams(FirstParam.Component.class) Closure closure) {
        return sum(new ArrayIterator<T>(self), initialValue, closure, false);
    }
public static < T > Object sum ( T [ ] self , Object initialValue , @ ClosureParams ( FirstParam . Component . class ) Closure closure ) { return sum ( new ArrayIterator < T > ( self ) , initialValue , closure , false ) ; }
Sums the result of applying a closure to each item of an array to some initial value.
<code>array.sum(initVal, closure)</code> is equivalent to:
<code>array.collect(closure).sum(initVal)</code>.

@param self         an array
@param closure      a single parameter closure that returns a numeric value.
@param initialValue the closure results will be summed to this initial value
@return The sum of the values returned by applying the closure to each
item of the array.
@since 1.7.1