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
+5.7k Fontello : How to load and use fonts?
+7.9k Golang : Find relative luminance or color brightness
+24.6k Golang : Generate MD5 checksum of a file
+14.2k Golang : Overwrite previous output with count down timer
+9k Golang : Generate EAN barcode
+16.1k Golang : Send email and SMTP configuration example
+16.2k Golang : Delete files by extension
+10.8k Golang : Calculate Relative Strength Index(RSI) example
+5k Golang : Calculate half life decay example
+8.2k Golang : How to check if input string is a word?
+21.5k Golang : Use TLS version 1.2 and enforce server security configuration over client
+3.4k Java : Get FX sentiment from website example