Skip to content

collibra/go-set

Repository files navigation

GO set

Quality Gate Status

Introduction

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.

Getting Started

Add this library as a dependency via go get github.com/collibra/go-set

Examples

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	
    }
}

About

go-set

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •