Class Bulk<T extends JsonReadable>

  • Type Parameters:
    T - Type of iterable objects
    All Implemented Interfaces:

    public final class Bulk<T extends JsonReadable>
    extends Object
    implements Iterable<T>
    Bulk items, with pre-saved JSON.

    This class should be used as a decorator for object obtained from Github, when you want to keep their JSON values in memory. For example:

     Iterable<Issue> issues = repo.issues().iterate(
       new HashMap<String, String>()
     for (Issue issue : issues) {
       System.out.println(new Issue.Smart(issue).title());

    Let's say, there are 50 issues in Github's repo. This code will make 52 HTTP requests to Github. The first one will fetch the first 30 issues in JSON array. Then, for every one of them, in order to retrieve issue title a separate HTTP request will be made. Then, one more page will be fetched, with 20 issues. And again, 20 new HTTP requests to get their titles.

    Class Bulk helps us to reduce the amount of this extra work:

     Iterable<Issue> issues = new Bulk<Issue>(
         new HashMap<String, String>()

    Now, there will be just two HTTP requests.

    $Id: a092cd0bcf716ebef386f1782b3b75e12b173730 $
    Yegor Bugayenko (
    See Also:
    • Constructor Detail

      • Bulk

        public Bulk​(Iterable<T> items)
        Public ctor.
        items - Items original
        Suppressed Checkstyle violations:
        AnonInnerLength (50 lines)