github.com/axamon/stringset

a set for strings written in go that is concurrency safe


Keywords
go, golang, set, strings, concurrency, golang-package, sets, thread-safe
License
MIT
Install
go get github.com/axamon/stringset

Documentation

stringset

GoDoc Build Status Go Report Card codecov Maintainability HitCount

stringset creates sets for strings in golang that are concurrency safe

Installation

go get -u github.com/axamon/stringset

Usage

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
}

Benchmarks

BenchmarkAdd-16          	 3000000	       497 ns/op

BenchmarkDelete-16       	 3000000	       539 ns/op

BenchmarkIntersect-16    	 1000000	      2168 ns/op

BenchmarkUnion-16        	 2000000	      1825 ns/op