Back to Lo

It Frompairs

docs/data/it-frompairs.md

1.53.0271 B
Original Source

Transforms a sequence of key/value pairs into a map. Alias of FromEntries().

go
pairs := it.Seq2(func(yield func(string, int) bool) {
    yield("a", 1)
    yield("b", 2)
    yield("c", 3)
})

result := it.FromPairs(pairs)
// map[string]int{"a": 1, "b": 2, "c": 3}