Louis is absolutely right, Multisets.sum(set1, set2)
certainly does work, nor does copying to an ImmutableSortedMultiset
cause any trouble.
public static void main(String[] args) {
final SortedMultiset<Integer> set1 = ImmutableSortedMultiset.of(1, 2, 2, 3, 3, 3);
final SortedMultiset<Integer> set2 = ImmutableSortedMultiset.of(1, 1, 2, 4);
final SortedMultiset<Integer> sum = ImmutableSortedMultiset.copyOf(Multisets.sum(set1, set2));
System.out.println(sum);
}
outputs:
[1 x 3, 2 x 3, 3 x 3, 4]
I suspect that it is the piece you have redacted, and replaced with ImmutableSortedMultiset.of();
that is giving you trouble. But I cannot comment too much there as you've neglected to share it.