We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44bc27a commit b596fdbCopy full SHA for b596fdb
iter.go
@@ -33,3 +33,12 @@ func IterValues[K comparable, V any](m map[K]V) iter.Seq[V] {
33
}
34
35
36
+
37
+// Collect returns a new map with the key-value pairs from seq.
38
+func Collect[K comparable, V any](seq iter.Seq2[K, V]) map[K]V {
39
+ result := make(map[K]V)
40
+ for k, v := range seq {
41
+ result[k] = v
42
+ }
43
+ return result
44
+}
0 commit comments