IsSubset tests whether t is a subset of s.
(t Set)
| 160 | |
| 161 | // IsSubset tests whether t is a subset of s. |
| 162 | func (s Set) IsSubset(t Set) bool { |
| 163 | if len(s) < len(t) { |
| 164 | return false |
| 165 | } |
| 166 | |
| 167 | for item := range t { |
| 168 | if !s.Has(item) { |
| 169 | return false |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | return true |
| 174 | } |
| 175 | |
| 176 | // IsSuperset tests whether t is a superset of s. |
| 177 | func (s Set) IsSuperset(t Set) bool { |