public bool Add(T item) { var ret = _inner.Root_Add(item, true, _lineage, _eq, false); if (ret == null) { return(false); } _inner = ret; return(true); }
/// <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 ImmSet <T> Add(T item) { var res = Root.Root_Add(item, true, Lineage.Mutable(), EqualityComparer, false); if (res == null) { return(this); } return(res.Wrap(EqualityComparer)); }
protected override ImmMap <TKey, TValue> Set(TKey k, TValue v, bool overwrite) { var r = _root.Root_Add(k, v, Lineage.Mutable(), _equality, overwrite); if (r == null && !overwrite) { throw Errors.Key_exists(k); } if (r == null) { return(this); } return(r.WrapMap(_equality)); }
public bool Add(KeyValuePair <TKey, TValue> item) { _inner = _inner.Root_Add(item.Key, item.Value, _lineage, _equality, true) ?? _inner; return(true); }