Skip to content

Instantly share code, notes, and snippets.

@bouk

bouk/set.go Secret

Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouk/c66f38b49aafa2aa02ba to your computer and use it in GitHub Desktop.
Save bouk/c66f38b49aafa2aa02ba to your computer and use it in GitHub Desktop.
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