* <p><b>Note:</b> The returned view performs slightly better when {@code
* set1} is the smaller of the two sets. If you have reason to believe one of
* your sets will generally be smaller than the other, pass it first.
My Caliper tests* show that the same is true for Multisets.intersection(Multiset, Multiset). The reverse appears to be true for Multisets.union(Multiset, Multiset), when the first argument is the larger of the two multisets it performs slightly better.
Both also logically follow from the documented iteration order of elements in the newly created multiset. However this might be worth mentioning in the java doc.
I would add the note from Sets.intersection(Set, Set) to Multisets.intersection(Multiset, Multiset) and Multisets.union(Multiset, Multiset).
*Calculating the size of the union and intersection of two HashMultisets with between 1k and 5k entries of in which the smaller set is a subset of the larger set.
The text was updated successfully, but these errors were encountered:
Currently
Sets.intersection(Set, Set)notes that:My Caliper tests* show that the same is true for
Multisets.intersection(Multiset, Multiset). The reverse appears to be true forMultisets.union(Multiset, Multiset), when the first argument is the larger of the two multisets it performs slightly better.Both also logically follow from the documented iteration order of elements in the newly created multiset. However this might be worth mentioning in the java doc.
I would add the note from
Sets.intersection(Set, Set)toMultisets.intersection(Multiset, Multiset)andMultisets.union(Multiset, Multiset).*Calculating the size of the union and intersection of two HashMultisets with between 1k and 5k entries of in which the smaller set is a subset of the larger set.
The text was updated successfully, but these errors were encountered: