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
+9.5k Golang : Interfacing with PayPal's IPN(Instant Payment Notification) example
+9.1k Golang : Get login name from environment and prompt for password
+38.8k Golang : How do I convert int to uint8?
+6.1k Golang : Array mapping with Interface
+3.9k Golang : A program that contain another program and executes it during run-time
+14.2k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+4.5k Golang : Stop goroutine without channel
+5.9k Golang : Pat multiplexer routing example
+7.7k Golang : Accept any number of function arguments with three dots(...)
+15.4k Golang : Set up source IP address before making HTTP request
+10.7k Golang : Split strings into command line arguments
+4.5k Swift : Convert string array to array example