stringset creates sets for strings in golang that are concurrency safe
go get -u github.com/axamon/stringset
package main
import (
"fmt"
"github.com/axamon/stringset"
)
func main() {
testSet := NewStringSet("pippo", "pluto", "paperino", "pippo")
slice := testSet.Strings()
sort.Strings(slice)
for _, element := range slice {
fmt.Println(element)
}
// Output:
// paperino
// pippo
// pluto
}
BenchmarkAdd-16 3000000 497 ns/op
BenchmarkDelete-16 3000000 539 ns/op
BenchmarkIntersect-16 1000000 2168 ns/op
BenchmarkUnion-16 2000000 1825 ns/op