public Assoc(TKey key, TValue value, Assoc <TKey, TValue> tail) { Key = key; Value = value; Count = tail.Count + 1; Tail = tail; }
Assoc() { Key = default(TKey); Value = default(TValue); Count = 0; Tail = this; }
public Assoc <TKey, TValue> Update(Assoc <TKey, TValue> source, out bool replaced, out bool mutated) { var newAssoc = source.TryRemove(Key, out mutated, out Value); if (!mutated) { replaced = false; return(default(Assoc <TKey, TValue>)); } CountChanged--; replaced = !newAssoc.IsEmpty; return(newAssoc); }
public Assoc <TKey, TValue> Update(Assoc <TKey, TValue> source, out bool replaced, out bool mutated) { replaced = true; mutated = true; return(source.SetOrAdd(Key, Value, out CountChanged)); }
public Assoc <TKey, TValue> Create(out bool mutated) { mutated = true; return(Assoc.Empty <TKey, TValue>().SetOrAdd(Key, Value, out CountChanged)); }