sum method

double sum()

Returns the sum of all elements in the collection.

Implementation

double sum() {
  double sum = 0.0;
  for (final element in iter) {
    sum += element;
  }
  return sum;
}