TakeWhile returns an Iterator adapter that yields values from the underlying Iterator as long as pred predicate function returns true.
(it Iterator[T], pred func(T) bool)
| 168 | // TakeWhile returns an Iterator adapter that yields values from the underlying |
| 169 | // Iterator as long as pred predicate function returns true. |
| 170 | func TakeWhile[T any](it Iterator[T], pred func(T) bool) Iterator[T] { |
| 171 | return &takeWhileIter[T]{ |
| 172 | inner: it, |
| 173 | pred: pred, |
| 174 | done: false, |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | func (it *takeWhileIter[T]) Next() Option[T] { |
| 179 | if it.done { |
no outgoing calls
searching dependent graphs…