Back to Lo

It Toanyseq

docs/data/it-toanyseq.md

1.53.0318 B
Original Source

ToAnySeq returns a sequence with all elements mapped to any type.

go
collection := func(yield func(int) bool) {
    yield(1)
    yield(2)
    yield(3)
}

anySeq := it.ToAnySeq(collection)
var result []any
for item := range anySeq {
    result = append(result, item)
}
// result contains [1, 2, 3] as any type