average method

double average()

Calculate the average using all values in the double list.

If there is no element, 0.0 is returned.

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

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

Implementation

double average() {
  if (isEmpty) {
    return 0.0;
  }
  return sum() / length;
}