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

Function EqualBy

iterator.go:477–491  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

475// Determines if the elements of two Iterators are equal using function cmp to
476// compare elements.
477func 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}

Callers 2

TestEqualByFunction · 0.85
EqualFunction · 0.85

Calls 3

IsNoneMethod · 0.80
UnwrapMethod · 0.80
NextMethod · 0.65

Tested by 1

TestEqualByFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…