Calculate the average using all values in the int list.
If there is no element, 0 is returned.
intのリストのすべての値を用いて平均を算出します。
要素がない場合は0が返されます。
double average() { if (isEmpty) { return 0; } return sum() / length; }