sum<U extends num> method
Implementation
U sum<U extends num>([ TFuncMapper<T, U>? funcMapper ]) {
if (funcMapper == null) {
if (T == num || T == int || T == double) {
return this.sum((x) => x as U);
}
throw "a mapper was not provided but the values' type is not numeric";
}
return this.reduceTo<U>((U total, T cur) => (total + funcMapper(cur)) as U, 0 as U);
}