public static function indexOf(Iterator $iterator, callable $predicate) : int
    {
        $i = 0;
        while ($iterator->valid()) {
            if (Predicates::call($predicate, $iterator->current())) {
                return $i;
            }
            $i++;
            $iterator->next();
        }
        return -1;
    }
public static function indexOf(Iterator $iterator, callable $predicate) : int
    {
        $i = 0;
        while ($iterator->valid()) {
            if (Predicates::call($predicate, $iterator->current())) {
                return $i;
            }
            $i++;
            $iterator->next();
        }
        return -1;
    }
public static function indexOf ( Iterator $ iterator , callable $ predicate ) : int { $ i = 0 ; while ( $ iterator -> valid ( ) ) { if ( Predicates :: call ( $ predicate , $ iterator -> current ( ) ) ) { return $ i ; } $ i ++ ; $ iterator -> next ( ) ; } return - 1 ; }
Returns the index in iterator of the first element that satisfies the provided predicate,
or -1 if the Iterator has no such elements.

@param Iterator $iterator
@param callable $predicate
@return int
Returns the index in iterator of the first element that satisfies the provided predicate or - 1 if the Iterator has no such elements .