average method
Returns the average of all elements in the iterable.
Example:
[1, 2, 3].average(); // 2.0
Implementation
double average() {
if (isEmpty) return 0.0;
return sum() / length;
}
Returns the average of all elements in the iterable.
Example:
[1, 2, 3].average(); // 2.0
double average() {
if (isEmpty) return 0.0;
return sum() / length;
}