4 ms·
> Go isn't different, it has map, that is Go implementation of a hash table. It's a bit nitpicky, but this always annoys me. Maps/dictionaries are not hashtabl
by tsimionescu 2y ago
> Go isn't different, it has map, that is Go implementation of a hash table.
It's a bit nitpicky, but this always annoys me. Maps/dictionaries are not hashtables. A hashtable is one of the structures you can use to implement a map. A hashtable stores arbitrary items, not key-value associations, and can be used to quickly retrieve an item knowing its hash. If you want to implement a map using a hashtable, you need to also define a type that wraps a key-value pair and handles hashing and equality by only comparing the key.
Also, maps can be implemented with other underlying data structures as well. Java's standard library even offers a built-in TreeMap, which uses a red-black tree to store the pairs instead of HashMap's hashtable.