A multiset with a sort relation between elements.
The sorting of elements has the following consequences:
- elements must be Comparable
- SortedMaps are a bit slower than HashMaps
- output of sorted multisets looks nicer than that of unsorted multisets
Since elements are sorted, we can easily define a sorting on SortedMultisets, too:
A sorted multiset is bigger than another one if it's biggest element is bigger
than the largest element of the other multiset; or the 2.nd-biggest if
the biggest elements are equal; or the 3.rd biggest, and so on.