/// <summary> /// Adds a new item to the set, or does nothing if the item already exists. /// </summary> /// <param name="item">The item to add.</param> /// <returns></returns> public override ImmSortedSet <T> Add(T item) { var ret = Root.Root_Add(item, true, Comparer, false, Lineage.Mutable()); if (ret == null) { return(this); } return(ret.Wrap(Comparer)); }
public bool Add(T item) { var ret = _inner.Root_Add(item, true, _comparer, false, _lineage); if (ret == null) { return(false); } _inner = ret; return(true); }
protected override ImmSortedMap <TKey, TValue> Set(TKey key, TValue value, bool overwrite) { var ret = Root.Root_Add(key, value, Comparer, overwrite, Lineage.Mutable()); if (ret == null && !overwrite) { throw Errors.Key_exists(key); } if (ret == null) { return(this); } return(ret.WrapMap(Comparer)); }
public bool Add(KeyValuePair <TKey, TValue> item) { _inner = _inner.Root_Add(item.Key, item.Value, _comparer, true, _lineage) ?? _inner; return(true); }