Exemple #1
0
            public bool Add(T item)
            {
                var ret = _inner.Root_Add(item, true, _lineage, _eq, false);

                if (ret == null)
                {
                    return(false);
                }
                _inner = ret;
                return(true);
            }
Exemple #2
0
        /// <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));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
 public bool Add(KeyValuePair <TKey, TValue> item)
 {
     _inner = _inner.Root_Add(item.Key, item.Value, _lineage, _equality, true) ?? _inner;
     return(true);
 }