My understanding of Multiset is a set with frequency, but I can always use Map to represent the frequency, is there other reason to use Multiset?
Advantages of a Multiset<E>
over a Map<E, Integer>
:
count(E)
, add(E, int)
, etc.Multiset<E>
obviously maps the elements to their counts. A Map<E, Integer>
could map the elements to arbitrary integers.See also: