Basic hash-map[string]string
on 8bit Pearson's hash-function.
An array of 255 elements of the *List
type is reserved.
The hash function has an output range [0...255]
of type int
.
If there is a collision, the linked list is expanded by one element at the end.
Code | Output |
// ...
// some code
func example() {
data := Map{}
data.insert("hello", "1")
data.insert("world", "1")
data.insert("hello", "2")
data.insert("!", "3")
fmt.Println(data.get_value("hello"))
fmt.Println(data.keys())
} |
2
["hello" "world" "!"] |