All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kohsuke.github.PagedIterable Maven / Gradle / Ivy

package org.kohsuke.github;

import java.util.ArrayList;
import java.util.List;

/**
 * {@link Iterable} that returns {@link PagedIterator}
 *
 * @author Kohsuke Kawaguchi
 */
public abstract class PagedIterable implements Iterable {
    public abstract PagedIterator iterator();

    /**
     * Eagerly walk {@link Iterable} and return the result in a list.
     */
    public List asList() {
        List r = new ArrayList();
        for(PagedIterator i = iterator(); i.hasNext();) {
            r.addAll(i.nextPage());
        }
        return r;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy