Files
lo/docs/data/it-entries.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

37 lines
767 B
Markdown

---
name: Entries
slug: entries
sourceRef: it/map.go#L77
category: it
subCategory: map
signatures:
- "func Entries[K comparable, V any](in ...map[K]V) iter.Seq2[K, V]"
playUrl: https://go.dev/play/p/ckLxqTE9KCz
variantHelpers:
- it#map#entries
similarHelpers:
- core#slice#entries
- it#map#fromentries
- it#map#topairs
position: 20
---
Transforms a map into a sequence of key/value pairs. Accepts multiple maps and concatenates their entries.
Examples:
```go
m := map[string]int{
"apple": 1,
"banana": 2,
"cherry": 3,
}
entriesSeq := it.Entries(m)
var keys []string
var values []int
for k, v := range entriesSeq {
keys = append(keys, k)
values = append(values, v)
}
// keys contains map keys, values contains corresponding values
```