List<BinCount<T>> computeCounts(Iterable<T> data) { final bins = this.map((e) => BinCount<T>(e, 0)).toList(); for (final T item in data) { bins.addSample(item); } return bins; }