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:
Multiset Javadoc
Multiset explained in the Guava Wiki
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With