Take returns an Iterator adapter that yields the n first elements from the underlying Iterator.
(it Iterator[T], n uint)
| 142 | // Take returns an Iterator adapter that yields the n first elements from the |
| 143 | // underlying Iterator. |
| 144 | func Take[T any](it Iterator[T], n uint) Iterator[T] { |
| 145 | return &takeIter[T]{ |
| 146 | inner: it, |
| 147 | take: n, |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func (it *takeIter[T]) Next() Option[T] { |
| 152 | if it.take == 0 { |
no outgoing calls
searching dependent graphs…