Determines if the elements of two Iterators are equal using function cmp to compare elements.
(first Iterator[T], second Iterator[T], cmp func(T, T) bool)
| 475 | // Determines if the elements of two Iterators are equal using function cmp to |
| 476 | // compare elements. |
| 477 | func EqualBy[T any](first Iterator[T], second Iterator[T], cmp func(T, T) bool) bool { |
| 478 | for { |
| 479 | v := first.Next() |
| 480 | if v.IsNone() { |
| 481 | return second.Next().IsNone() |
| 482 | } |
| 483 | u := second.Next() |
| 484 | if u.IsNone() { |
| 485 | return false |
| 486 | } |
| 487 | if !cmp(v.Unwrap(), u.Unwrap()) { |
| 488 | return false |
| 489 | } |
| 490 | } |
| 491 | } |
searching dependent graphs…