Skip to content

twharmon/sets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sets

Generic sets for Go.

codecov

Documentation

For full documentation see pkg.go.dev.

Install

go get github.com/twharmon/sets

Usage

package main

import (
	"fmt"

	"github.com/twharmon/sets"
)

func main() {
	// Create a new set of ints
	s := sets.New[int]()

	// Add some values
	s.Add(1, 2, 3)

	// Check for a value
	s.Contains(2) // true

	// Remove a value
	s.Remove(2)

	// Get slice of all values in set
	s.Slice() // [1 3]

	// Merge another set into s
	s.Merge(sets.New(2, 4))

	// Clear the set
	s.Clear()
}

Contribute

Make a pull request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages