diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-30 02:17:15 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-30 21:29:51 -0600 |
commit | ea4110f666b3c3d66998cae4e68e317df646f2fd (patch) | |
tree | 6f9bcfbdc6c365694653286dbda334c8afb5889a /lib/containers | |
parent | a371ae78e5280f0a2075692dbb2cfeed4c39bddb (diff) |
wip better reattach
Diffstat (limited to 'lib/containers')
-rw-r--r-- | lib/containers/set.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/containers/set.go b/lib/containers/set.go index 4e40894..8cd700a 100644 --- a/lib/containers/set.go +++ b/lib/containers/set.go @@ -67,3 +67,15 @@ func (o *Set[T]) Delete(v T) { } delete(*o, v) } + +func (small Set[T]) HasIntersection(big Set[T]) bool { + if len(big) < len(small) { + small, big = big, small + } + for v := range small { + if _, ok := big[v]; ok { + return true + } + } + return false +} |