For some applications,
dict[key] << val
dict[key].uniq!
will be good enough. But this will still slow down if the number of
values in the list gets large, in which case a hash of hashes would be
better:
dict[key] ||= {}
dict[key][val] = true
To get the values, you'd then use dict[key].keys (which in ruby 1.8
would be in an arbitrary order, and in 1.9 would be in order of first
insertion)
--
Posted via http://www.ruby-forum.com/.