This library introduce sets in golang.
Set is a container that store unique elements in no particular order.
Sets are an alias for map[T]struct{}
where T is a comparable type.
Add this library as a dependency via go get github.com/collibra/go-set
import github.com/collibra/go-set/set
func Foo() {
var a set.Set[int]
a = set.NewSet[int](2, 5, 9, 7)
l := len(a) //l = 4
contains := a.Contains(4) //false
for i := range(a) {
//loop over all elements in the set
}
}