public static function first(Iterator $iterator)
    {
        $iterator->rewind();
        if (!$iterator->valid()) {
            throw new InvalidArgumentException("Iterator is empty");
        }
        return $iterator->current();
    }
public static function first(Iterator $iterator)
    {
        $iterator->rewind();
        if (!$iterator->valid()) {
            throw new InvalidArgumentException("Iterator is empty");
        }
        return $iterator->current();
    }
public static function first ( Iterator $ iterator ) { $ iterator -> rewind ( ) ; if ( ! $ iterator -> valid ( ) ) { throw new InvalidArgumentException ( "Iterator is empty" ) ; } return $ iterator -> current ( ) ; }
Returns the first element in iterator or throws an Exception if iterator is empty
@param Iterator $iterator
@return mixed
Returns the first element in iterator or throws an Exception if iterator is empty