Esempio n. 1
0
        public bool TryRemove(TKey key, out ImmutableTreeMap <TKey, TValue> newMap)
        {
            Node newNode;

            if (TryRemove(key, out newNode))
            {
                newMap = newNode == null ? Empty : new ImmutableTreeMap <TKey, TValue>(newNode);
                return(true);
            }
            newMap = this;
            return(false);
        }
Esempio n. 2
0
        public bool TryAdd(TKey key, TValue value, out ImmutableTreeMap <TKey, TValue> newTreeMap)
        {
            Node newNode;
            var  couldAdd = TryAdd(key, value, out newNode, AddOperation.AddOnlyUnique);

            if (!couldAdd)
            {
                newTreeMap = this;
                return(false);
            }
            newTreeMap = new ImmutableTreeMap <TKey, TValue>(newNode);
            return(true);
        }