Back to Lo

It Keys

docs/data/it-keys.md

1.53.0368 B
Original Source

Creates a sequence of the map keys. Accepts multiple maps and concatenates their keys.

Examples:

go
m1 := map[string]int{
    "apple":  1,
    "banana": 2,
}
m2 := map[string]int{
    "cherry": 3,
    "date":   4,
}
keysSeq := it.Keys(m1, m2)
var result []string
for k := range keysSeq {
    result = append(result, k)
}
// result contains keys from both maps