Fast and generic Set and Map implementations using binary-search-trees.
Full documentation is available on GoDoc
As a Set:
{
set := bst.NewSet(5)
set.Add(bst.Int(3))
set.Add(bst.Int(5))
set.Add(bst.Int(1))
set.Add(bst.Int(3))
for iter := set.Iterator(); iter.Next(); {
fmt.Println(iter.Value())
}
}
As a Map:
{
set := bst.NewMap(5)
set.Set(bst.Int(5), "bar")
set.Set(bst.Int(3), "foo")
for iter := set.Iterator(); iter.Next(); {
fmt.Println(iter.Key(), iter.Value())
}
}