sumBy method

num sumBy(
  1. num f(
    1. E e
    )
)

Implementation

num sumBy(num f(E e)) {
  num r = 0;
  this.forEach((element) => r += f(element));
  return r;
}