syft/internal/stringset.go
2020-06-04 14:42:59 -04:00

29 lines
387 B
Go

package internal
type Set map[string]struct{}
func NewStringSet() Set {
return make(Set)
}
func NewStringSetFromSlice(start []string) Set {
ret := make(Set)
for _, s := range start {
ret.Add(s)
}
return ret
}
func (s Set) Add(i string) {
s[i] = struct{}{}
}
func (s Set) Remove(i string) {
delete(s, i)
}
func (s Set) Contains(i string) bool {
_, ok := s[i]
return ok
}