Skip to content

a set for strings written in go that is concurrency safe

License

Notifications You must be signed in to change notification settings

axamon/stringset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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