MCPcopy Create free account
hub / github.com/Soft/iter / Flatten

Function Flatten

iterator.go:399–405  ·  view source on GitHub ↗

Flatten returns an Iterator adapter that flattens nested iterators.

(it Iterator[Iterator[T]])

Source from the content-addressed store, hash-verified

397
398// Flatten returns an Iterator adapter that flattens nested iterators.
399func Flatten[T any](it Iterator[Iterator[T]]) Iterator[T] {
400 return &flattenIter[T]{
401 inner: it,
402 current: Empty[T](),
403 done: false,
404 }
405}
406
407func (it *flattenIter[T]) Next() Option[T] {
408 for {

Callers 1

TestFlattenFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFlattenFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…