I understand that Java HashMap elements are stored in “buckets” based on the hashes of the elements’ keys. Does that same hashing occur in C# dictionaries? If not, then how does lookup work?
There are several kind of Dictionarys inside C# System.Collections – namespace. They use different strategies to store theire internal data:
This one System.Collections.Specialized.HybridDictionary
uses DoubleLinkedLists until a certain size is reached, then switches to Hashsets. The “normal” System.Collections.Generics-Dictionary uses Hashsets internally all the time. There is also a Dictionary for concurrent uses – look it up yourself (Concurrent Dictionary)if you like.
So it depends on what kind of Dictionary you are using and (in above case) might change due to internal considerations of the class you are using for performance or other reasons.