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
+10.5k Golang : Select region of interest with mouse click and crop from image
+6.2k Golang : Calculate US Dollar Index (DXY)
+9.7k Golang : Load ASN1 encoded DSA public key PEM file example
+9.4k Golang : Play .WAV file from command line
+12.9k Golang : Convert IPv4 address to packed 32-bit binary format
+19.2k Golang : Check if directory exist and create if does not exist
+4.6k JavaScript : Rounding number to decimal formats to display currency
+11.6k Golang : Simple file scaning and remove virus example
+13.4k Golang : Generate Code128 barcode
+5k Google : Block or disable caching of your website content
+8.2k Golang : Add build version and other information in executables
+7.3k Golang : How to fix html/template : "somefile" is undefined error?