This project has been archived. Please check out tidwall/hashmap for a fitter, happier, more productive hashmap library.
A simple and efficient hashmap package for Go using the
xxhash
algorithm,
open addressing, and
robin hood hashing.
This is an alternative to the standard Go map.
To start using rhh
, install Go and run go get
:
$ go get github.com/tidwall/rhh
This will retrieve the library.
The Map
type works similar to a standard Go map, and includes four methods:
Set
, Get
, Delete
, Len
.
var m rhh.Map
m.Set("Hello", "Dolly!")
val, _ := m.Get("Hello")
fmt.Printf("%v\n", val)
val, _ = m.Delete("Hello")
fmt.Printf("%v\n", val)
val, _ = m.Get("Hello")
fmt.Printf("%v\n", val)
// Output:
// Dolly!
// Dolly!
// <nil>
Josh Baker @tidwall
Source code is available under the MIT License.