コード例 #1
0
        internal static RedBlackNode Replace(System.Collections.IComparer comp, RedBlackNode t, object key, object val)
        {
            int c = comp.Compare(key, t.Key);

            return(t.Replace(t.Key,
                             c == 0 ? val : t.Value,
                             c < 0 ? Replace(comp, t.Left, key, val) : t.Left,
                             c > 0 ? Replace(comp, t.Right, key, val) : t.Right));
        }