Intersection returns the elements contained in both sets.
(o FingerprintSet)
| 80 | |
| 81 | // Intersection returns the elements contained in both sets. |
| 82 | func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet { |
| 83 | myLength, otherLength := len(s), len(o) |
| 84 | if myLength == 0 || otherLength == 0 { |
| 85 | return FingerprintSet{} |
| 86 | } |
| 87 | |
| 88 | subSet := s |
| 89 | superSet := o |
| 90 | |
| 91 | if otherLength < myLength { |
| 92 | subSet = o |
| 93 | superSet = s |
| 94 | } |
| 95 | |
| 96 | out := FingerprintSet{} |
| 97 | |
| 98 | for k := range subSet { |
| 99 | if _, ok := superSet[k]; ok { |
| 100 | out[k] = struct{}{} |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | return out |
| 105 | } |
no outgoing calls