Skip to content

abishekk92/goset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goset

Build Status

Set implementation for golang

To install goset

    go get github.com/abishekk92/goset

To Create a new set

    import (
        "github.com/abishekk92/goset"
        )

    func main() {
        newSet := goset.NewSet() //Creates a new set
        newSet.Add("a") //Adds a new element to the set
        newSet.Add("b")
        newSet.del("b") //Rmeoves an element from the set
        newSet.isMember("a") //Checks if 'a' is a member of the set
    }

To Union two sets

    import (
        "github.com/abishekk92/goset"
        )

    func main() {
        A := goset.NewSet()
        B := goset.NewSet()
        A.add("a")
        A.add("b")
        B.add("a")
        uninonSet := A.Union(B)
    }

To Intersect two sets

    import (
        "github.com/abishekk92/goset"
        )

    func main() {
        A := goset.NewSet()
        B := goset.NewSet()
        A.add("a")
        A.add("b")
        B.add("a")
        intersectionSet := A.Intersect(B)
    }

About

Set implementation for golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages