Smalltalk has a collection class called Bag, which is an unordered
collection of objects which keeps track of the number of occurences of
each equal element in the collection, so you can do something like:
bag <- Bag.new
bag.add: 1;add: 2: add: 1; add: 4
bag.occurencesOf: 1 => 2
bag.occurencesOf: 1 => 1
bag.occurrencesOf: 1 => 1
Now Bag is kind of the black sheep of the Smalltalk collection
classes. Most Smalltalkers would either never use it or overuse it.
The only use I could think of was to implement a histogram.
My blog on Ruby