Skip to content

ferreiravinicius/goset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation of set for Golang.
Set is a collection that contains no duplicate elements.

Curently in early development phase.

Install

$ go get -u github.com/ferreiravinicius/goset

Hash Set

Creating a new set

import "github.com/ferreiravinicius/goset/hashset"

set := hashset.New() // Set{}
set := hashset.From(1, 2, 3) // Set{1, 2, 3}
set := hashset.New(100) // creates new map with size of 100

Iterating over a set using ForEach

set := hashset.From(1, 2, 3) 
set.ForEach(func(item interface{}) { 
  n := item.(int) 
  // doSomething(n)
})

About

Set implementation for Golang

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages