We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
BuildSet
1 parent be84cc8 commit d0c0347Copy full SHA for d0c0347
internal/xmaps/set.go
@@ -0,0 +1,10 @@
1
+package xmaps
2
+
3
+// BuildSet builds a set from the given values.
4
+func BuildSet[K comparable](s ...K) map[K]struct{} {
5
+ r := make(map[K]struct{}, len(s))
6
+ for _, v := range s {
7
+ r[v] = struct{}{}
8
+ }
9
+ return r
10
+}
0 commit comments