-
-
Save bouk/c66f38b49aafa2aa02ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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