Any tests if any element of the Iterator matches a predicate. An empty Iterator returns false.
(it Iterator[T], pred func(T) bool)
| 438 | // Any tests if any element of the Iterator matches a predicate. An empty |
| 439 | // Iterator returns false. |
| 440 | func Any[T any](it Iterator[T], pred func(T) bool) bool { |
| 441 | v := it.Next() |
| 442 | for v.IsSome() { |
| 443 | if pred(v.Unwrap()) { |
| 444 | return true |
| 445 | } |
| 446 | v = it.Next() |
| 447 | } |
| 448 | return false |
| 449 | } |
| 450 | |
| 451 | // Nth returns nth element of the Iterator. |
| 452 | func Nth[T any](it Iterator[T], n uint) Option[T] { |