Create a gist now

Instantly share code, notes, and snippets.

@bouk /set.go Secret
Last active Aug 29, 2015

What would you like to do?
type Set map[T]bool
func New() Set {
return make(Set)
}
func (set Set) Add(key T) {
set[key] = true
}
func (set Set) Contains(key T) bool {
return set[key]
}
func (set Set) Remove(key T) {
delete(set, key)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment