Beispiel #1
0
        // *** ICloneable interface implementation ***

        public MultiSet <T> Clone()
        {
            MultiSet <T> clone = new MultiSet <T>(mItems.Comparer);

            clone.AddRange(mItems);
            return(clone);
        }
Beispiel #2
0
        public static MultiSet <T> Union(MultiSet <T> a, MultiSet <T> b)
        {
            Utils.ThrowException(a == null ? new ArgumentNullException("a") : null);
            Utils.ThrowException(b == null ? new ArgumentNullException("b") : null);
            MultiSet <T> c = a.Clone(); // *** inherits comparer from a (b is expected to have the same comparer)

            c.AddRange((IEnumerable <KeyValuePair <T, int> >)b);
            return(c);
        }