Пример #1
0
        public ImmutableTreeSet <TValue> AddOrUpdate(TValue value)
        {
            Node newNode;

            TryAdd(value, value, out newNode, AddOperation.AddOrUpdate);
            var newTreeMap = new ImmutableTreeSet <TValue>(newNode);

            return(newTreeMap);
        }
Пример #2
0
        public bool TryRemove(TValue value, out ImmutableTreeSet <TValue> newMap)
        {
            Node newNode;

            if (TryRemove(value, out newNode))
            {
                newMap = newNode == null ? Empty : new ImmutableTreeSet <TValue>(newNode);
                return(true);
            }
            newMap = this;
            return(false);
        }
Пример #3
0
        public bool TryAdd(TValue value, out ImmutableTreeSet <TValue> newTreeMap)
        {
            Node newNode;
            var  couldAdd = TryAdd(value, value, out newNode, AddOperation.AddOnlyUnique);

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