In .NET, there is a constructor for Dictionary
that takes one parameter, int capacity
. This is the same as with many other collecti
Actually I was the one that asked Microsoft to implement TrimExcess. I already presented more than one article that deals with dictionaries and in all cases I implemented TrimExcess. In fact, the Resize used when the buckets are too small can be invoked when increasing or decreasing the size of the buckets.
Today I just published another article, it is a C++ implementation of a dictionary, which supports TrimExcess: http://www.codeproject.com/Articles/761040/A-NET-like-Dictionary-in-Cplusplus
Another implementation (.NET) can be found in this article: http://www.codeproject.com/Articles/548406/Dictionary-plus-Locking-versus-ConcurrentDictionar