1
0
Fork 0
forked from External/ergo

Use our own stringset instead of menge's

This commit is contained in:
Daniel Oaks 2021-09-13 06:51:43 +10:00
parent 060d06ba6a
commit e6ee9e50e0
3 changed files with 25 additions and 7 deletions

View file

@ -15,3 +15,22 @@ func (s StringSet) Has(str string) bool {
func (s StringSet) Add(str string) {
s[str] = empty{}
}
func (s StringSet) Remove(str string) {
_, ok := s[str]
if ok {
delete(s, str)
}
}
func (s StringSet) Size() int {
return len(s)
}
func (s StringSet) Keys() (keys []string) {
for key := range s {
keys = append(keys, key)
}
return keys
}