averageE method

T averageE ()

Calculates the average of all numerical values in the enumerable.

Applies a predefined averaging function to all values in the enumerable. This method can only be called on an enumerable of a numerical type (num, int, or double). Otherwise an IncompatibleTypeError will be thrown.

For int enumerables, the result will be an int as well (the result of an integer division between the sum and the number of elements). For num and double enumerables, the result will be a double.

The averageE function will iterate over every element in the enumerable.

Implementation

T averageE() {
  IncompatibleTypeError.checkValidType(T, AverageReducers.director.keys);
  return AverageReducers.director[T](this);
}