public Collection next()

in org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageIterator.java [163:199]


	public Collection<V> next() {
		if (!hasNext())
			throw new NoSuchElementException();
		if (next != null)
			if (nextPage < 1)
				request.setUri(next);
			else
				try {
					request.setUri(new URL(next).getFile());
				} catch (MalformedURLException e) {
					request.setUri(next);
				}

		GitHubResponse response;
		try {
			response = client.get(request);
		} catch (IOException e) {
			throw new NoSuchPageException(e);
		}
		Collection<V> resources = null;
		Object body = response.getBody();
		if (body != null)
			if (body instanceof Collection)
				resources = (Collection<V>) body;
			else if (body instanceof IResourceProvider)
				resources = ((IResourceProvider<V>) body).getResources();
			else
				resources = (Collection<V>) Collections.singletonList(body);
		if (resources == null)
			resources = Collections.emptyList();
		nextPage++;
		next = response.getNext();
		nextPage = parsePageNumber(next);
		last = response.getLast();
		lastPage = parsePageNumber(last);
		return resources;
	}