MCPcopy Create free account
hub / github.com/prometheus/common / Intersection

Method Intersection

model/fingerprinting.go:82–105  ·  view source on GitHub ↗

Intersection returns the elements contained in both sets.

(o FingerprintSet)

Source from the content-addressed store, hash-verified

80
81// Intersection returns the elements contained in both sets.
82func (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}

Callers 1

Calls

no outgoing calls

Tested by 1