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.8k Golang : How to generate Code 39 barcode?
+25.5k Golang : Convert uint value to string type
+19.4k Golang : Check if directory exist and create if does not exist
+8.5k Golang : Implementing class(object-oriented programming style)
+16.5k Golang : How to extract links from web page ?
+22.5k Golang : Read directory content with filepath.Walk()
+8.1k Swift : Convert (cast) String to Float
+27.6k Golang : Convert CSV data to JSON format and save to file
+6.9k Golang : Derive cryptographic key from passwords with Argon2
+13.6k Golang : Read from buffered reader until specific number of bytes
+4.9k Fix Google Analytics Redundant Hostnames problem
+10.7k RPM : error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery