Skip to content

Instantly share code, notes, and snippets.

@bouk

bouk/set.go Secret

Last active August 29, 2015 14:06
Show Gist options
  • 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