public MSet <T> With(T item) { var set = _set.CloneFreeze(); if (set.Add(ref item, Comparer, false)) { return(new MSet <T>(set, _comparer, _count + 1)); } return(this); }
internal MapOrMMap(InternalSet <KeyValuePair <K, V> > set, IEqualityComparer <K> keyComparer, int count) { _set = set; _keyComparer = keyComparer; _count = count; _set.CloneFreeze(); }
internal Set(InternalSet <T> set, IEqualityComparer <T> comparer, int count) { Debug.Assert(count >= 0); _set = set; _comparer = comparer; _count = count; set.CloneFreeze(); }
public Set(IEnumerable <T> list, IEqualityComparer <T> comparer) { _set = new InternalSet <T>(); _comparer = comparer; _count = 0; if (list != null) { _count = _set.UnionWith(list, comparer, false); _set.CloneFreeze(); } if (comparer == null && !_set.HasRoot) { // give it a root so that Comparer does not change _comparer _set = InternalSet <T> .Empty; } }