sum method

double sum()

Calculate the sum using all values in the double list.

If there is no element, 0.0 is returned.

doubleのリストのすべての値を用いて合計を算出します。

要素がない場合は0.0が返されます。

Implementation

double sum() {
  if (isEmpty) {
    return 0.0;
  }
  return reduce((a, b) => a + b);
}