Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 612 Bytes

README.md

File metadata and controls

34 lines (23 loc) · 612 Bytes

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