add StringSet.HasAny

This commit is contained in:
deads2k
2015-04-29 11:24:38 -04:00
parent 8fa21ebd62
commit f258717f26
2 changed files with 22 additions and 0 deletions

View File

@@ -75,6 +75,16 @@ func (s StringSet) HasAll(items ...string) bool {
return true
}
// HasAny returns true if any items are contained in the set.
func (s StringSet) HasAny(items ...string) bool {
for _, item := range items {
if s.Has(item) {
return true
}
}
return false
}
// Difference returns a set of objects that are not in s2
// For example:
// s1 = {1, 2, 3}