# File multiset.rb, line 337 def map_with ret = Multiset.new self.each_pair do |item, count| val = yield(item, count) ret.add(val[0], val[1]) end ret end