src/precore/util/Iterators.php
public static function elementsEqual(Iterator $iterator1, Iterator $iterator2) : bool
    {
        while ($iterator1->valid() && $iterator2->valid()) {
            if (!Objects::equal($iterator1->current(), $iterator2->current())) {
                return false;
            }
            $iterator1->next();
            $iterator2->next();
        }
        return !$iterator1->valid() && !$iterator2->valid();
    }
public static function elementsEqual(Iterator $iterator1, Iterator $iterator2) : bool
    {
        while ($iterator1->valid() && $iterator2->valid()) {
            if (!Objects::equal($iterator1->current(), $iterator2->current())) {
                return false;
            }
            $iterator1->next();
            $iterator2->next();
        }
        return !$iterator1->valid() && !$iterator2->valid();
    }
public static function elementsEqual ( Iterator $ iterator1 , Iterator $ iterator2 ) : bool { while ( $ iterator1 -> valid ( ) && $ iterator2 -> valid ( ) ) { if ( ! Objects :: equal ( $ iterator1 -> current ( ) , $ iterator2 -> current ( ) ) ) { return false ; } $ iterator1 -> next ( ) ; $ iterator2 -> next ( ) ; } return ! $ iterator1 -> valid ( ) && ! $ iterator2 -> valid ( ) ; }
Checks whether the elements provided by the given iterators are equal correspondingly.
It uses {@link Objects::equal()} for equality check.

@param Iterator $iterator1
@param Iterator $iterator2
@return bool
Checks whether the elements provided by the given iterators are equal correspondingly . It uses { @link Objects :: equal () } for equality check .