Returns a new set with all items in both sets.
(other StringSet)
| 70 | |
| 71 | // Returns a new set with all items in both sets. |
| 72 | func (set StringSet) Union(other StringSet) StringSet { |
| 73 | unionedSet := NewStringSet() |
| 74 | |
| 75 | for elem := range set { |
| 76 | unionedSet.Add(elem) |
| 77 | } |
| 78 | for elem := range other { |
| 79 | unionedSet.Add(elem) |
| 80 | } |
| 81 | return unionedSet |
| 82 | } |
| 83 | |
| 84 | // Returns a new set with items that exist only in both sets. |
| 85 | func (set StringSet) Intersect(other StringSet) StringSet { |