sum method

T sum()

Returns the sum of the entries.

The iterable must not be empty.

Implementation

T sum() {
  mustHaveElements();
  return reduce((value, current) => (value + current) as T);
}