sum method

int sum()

Returns sum of all elements

Implementation

int sum() {
  int total = 0;
  for (final element in this) {
    total += element;
  }
  return total;
}