public static function get(Iterator $iterator, int $position)
    {
        Iterators::advance($iterator, $position);
        if (!$iterator->valid()) {
            throw new OutOfBoundsException("The requested index '{$position}' is invalid");
        }
        return $iterator->current();
    }
public static function get(Iterator $iterator, int $position)
    {
        Iterators::advance($iterator, $position);
        if (!$iterator->valid()) {
            throw new OutOfBoundsException("The requested index '{$position}' is invalid");
        }
        return $iterator->current();
    }
public static function get ( Iterator $ iterator , int $ position ) { Iterators :: advance ( $ iterator , $ position ) ; if ( ! $ iterator -> valid ( ) ) { throw new OutOfBoundsException ( "The requested index '{$position}' is invalid" ) ; } return $ iterator -> current ( ) ; }
Advances iterator position times, returning the element at the positionth position.

@param Iterator $iterator
@param int $position
@return mixed
@throws OutOfBoundsException if position does not exist
Advances iterator position times returning the element at the positionth position .