Golang : Of hash table and hash map
A short note for myself. Was looking to build a knowledge base consisting of a keyword or key string and then lookup for the nearest possible string answer.
This kind situation calls for a hash table and was looking for hash table equivalent in Golang and ....just found out that Golang's map is equivalent to other programming languages hash map or hash table! #facepalm to myself.
In general, a hash map is useful as it offers fast lookups, adds, and deletes. In Golang, the built-in map type has these properties.
NOTE : Map types are reference types, like pointers or slices, and so the value of m above is nil; it doesn't point to an initialized map. A nil map behaves like an empty map when reading, but attempts to write to a nil map will cause a runtime panic; don't do that. To initialize a map, use the built in make function:
m = make(map[string]int)
Reference :
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+15.7k Golang : Get sub string example
+20.3k Golang : Convert date string to variants of time.Time type examples
+4.9k Golang : Issue HTTP commands to server and port example
+5.3k Javascript : How to refresh page with JQuery ?
+11.2k Golang : Secure file deletion with wipe example
+8.4k Golang : Gaussian blur on image and camera video feed examples
+6.2k Golang : Combine slices of complex numbers and operation example
+4.9k Golang : Get FX sentiment from website example
+17.9k Golang : Get path name to current directory or folder
+21.6k Golang : Match strings by wildcard patterns with filepath.Match() function
+5.9k Apt-get to install and uninstall Golang
+8.6k Golang : Inject/embed Javascript before sending out to browser example