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
+47k Golang : Upload file from web browser to server
+4.4k PHP : Hide PHP version information from curl
+5.7k Golang : Reverse by word
+9.3k Golang : Allow Cross-Origin Resource Sharing request
+3.3k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+7.9k Golang : io.Reader causing panic: runtime error: invalid memory address or nil pointer dereference
+5.2k Golang : How to solve "too many .rsrc sections" error?
+5k Facebook : How to force facebook to scrape latest URL link data?
+29.2k Golang : How to redirect to new page with net/http?
+18.6k Android Studio : AlertDialog and EditText to get user string input example
+13.7k nginx: [emerg] unknown directive "ssl"
+20.5k Golang : Join arrays or slices example