@@ -0,0 +1,3158 @@
+package github.update;%0A%0Aimport static org.eclipse.egit.github.core.client.IGitHubConstants.PARAM_PAGE;%0Aimport github.GitHubClientExtended;%0A%0Aimport java.io.IOException;%0Aimport java.net.MalformedURLException;%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0Aimport java.net.URL;%0Aimport java.util.Iterator;%0Aimport java.util.NoSuchElementException;%0A%0Aimport org.eclipse.egit.github.core.client.GitHubRequest;%0Aimport org.eclipse.egit.github.core.client.GitHubResponse;%0Aimport org.eclipse.egit.github.core.client.NoSuchPageException;%0Aimport org.eclipse.egit.github.core.util.UrlUtils;%0A%0A/**%0A * Iterator for getting values of a header field from paged responses%0A * @see org.eclipse.egit.github.core.client.PageIterator%0A */%0Apublic class PageHeaderIterator implements Iterable%3CString%3E, Iterator%3CString%3E %7B%0A    private final GitHubRequest request;%0A    private final GitHubClientExtended client;%0A    private final String headerField;%0A%0A    private int nextPage; // Current page number%0A    private String next; // Next uri to be fetched%0A%0A    public PageHeaderIterator(GitHubRequest request, GitHubClientExtended client,%0A                              String headerField) %7B%0A        this.request = request;%0A        this.client = client;%0A        this.headerField = headerField;%0A%0A        next = request.getUri();%0A        nextPage = parsePageNumber(next);%0A    %7D%0A%0A    /**%0A     * Parses page number from uri%0A     *%0A     * @param uri%0A     * @return page number%0A     */%0A    private int parsePageNumber(String uri) %7B%0A        if (uri == null %7C%7C uri.length() == 0) %7B%0A            return -1;%0A        %7D%0A%0A        final URI parsed;%0A        try %7B%0A            parsed = new URI(uri);%0A        %7D catch (URISyntaxException e) %7B%0A            return -1;%0A        %7D%0A%0A        final String param = UrlUtils.getParam(parsed, PARAM_PAGE);%0A        if (param == null %7C%7C param.length() == 0) %7B%0A            return -1;%0A        %7D%0A%0A        try %7B%0A            return Integer.parseInt(param);%0A        %7D catch (NumberFormatException nfe) %7B%0A            return -1;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public boolean hasNext() %7B%0A        return nextPage == 0 %7C%7C next != null;%0A    %7D%0A%0A    /**%0A     * Returns the value of headerField of the next response page%0A     * @return the value of headerField of the next response page%0A     */%0A    @Override%0A    public String next() %7B%0A        if (!hasNext()) %7B%0A            throw new NoSuchElementException();%0A        %7D%0A%0A        if (next != null) %7B%0A            if (nextPage %3C 1) %7B%0A                request.setUri(next);%0A            %7D else %7B%0A                try %7B%0A                    request.setUri(new URL(next).getFile());%0A                %7D catch (MalformedURLException e) %7B%0A                    request.setUri(next);%0A                %7D%0A            %7D%0A        %7D%0A%0A        GitHubResponse response;%0A        try %7B%0A            response = client.head(request);%0A        %7D catch (IOException e) %7B%0A            throw new NoSuchPageException(e);%0A        %7D%0A%0A        nextPage++;%0A        next = response.getNext();%0A        nextPage = parsePageNumber(next);%0A%0A        return response.getHeader(headerField);%0A    %7D%0A%0A    @Override%0A    public Iterator%3CString%3E iterator() %7B%0A        return this;%0A    %7D%0A%7D

Implement pages' headers iterator