List<Bin<T>> computeBins(Iterable<T> data) { final bins = this.map((e) => Bin<T>(e, <T>[])).toList(); for (final T item in data) { bins.addSample(item); } return bins; }