Skip to content

RIterableDoubleOps

extension RIterableDoubleOps on RIterableOnce<double>

Methods

product() extension

double product()

Returns the product of all elements in this list

Available on RIterableOnce<A>, provided by the RIterableDoubleOps extension

Implementation
dart
double product() {
  var p = 1.0;
  final it = iterator;

  while (it.hasNext) {
    p *= it.next();
  }

  return p;
}

sum() extension

double sum()

Returns the sum of all elements in this list

Available on RIterableOnce<A>, provided by the RIterableDoubleOps extension

Implementation
dart
double sum() {
  var s = 0.0;
  final it = iterator;

  while (it.hasNext) {
    s += it.next();
  }

  return s;
}