}
public <V> MutableBag<V> collect(final DoubleToObjectFunction<? extends V> function)
{
final HashBag<V> result = HashBag.newBag(this.items.size());
this.forEachWithOccurrences(new DoubleIntProcedure()
{
public void value(double each, int occurrences)
{
result.addOccurrences(function.valueOf(each), occurrences);
}