/// <summary> /// Returns a dictionary with the same keys. The value for each key is /// obtained by calling <c>func(key, this[key])</c>. /// </summary> /// <typeparam name="TValue1">The type of the values in the returned dictionary.</typeparam> /// <param name="func">The function mapped.</param> /// <returns>The resulting dictionary.</returns> public TreeDictionary <TKey, TValue1, TComparer> Map <TValue1>(Func <TKey, TValue, TValue1> func) { if (Count == 0) { return(TreeDictionary <TKey, TValue1, TComparer> .Empty); } return(TreeDictionary <TKey, TValue1, TComparer> .Balanced( _key, func(_key, _value), _left.Map(func), _right.Map(func))); }