title: do...while() using Java 8 stream?
body: <p>I want to convert this java do...while() to a Java 8.</p>
  
  <pre><code>private static final Integer PAGE_SIZE = 200;
  int offset = 0;
  
  Page page = null;
  do {
      // Get all items.
      page = apiService.get(selector);
  
      // Display items.
      if (page.getEntries() != null) {
      for (Item item : page.getEntries()) {
          System.out.printf("Item with name '%s' and ID %d was found.%n", item.getName(),
              item.getId());
      }
      } else {
      System.out.println("No items were found.");
      }
  
      offset += PAGE_SIZE;
      selector = builder.increaseOffsetBy(PAGE_SIZE).build();
  } while (offset &lt; page.getTotalNumEntries());
  </code></pre>
  
  <p>This code makes api call to <code>apiService</code> and retrieves data. Then, I want to loop until offset is less than <code>totalNumberEntries</code>.</p>
  
  <p>What is prohibiting me from using <code>while()</code> or <code>foreach with step</code> or <code>any other kind of loop</code> loop is I don't know the <code>totalNumberEntries</code> without making API call (which is done inside the loop).</p>
  
  <p>One option I can think of is making the API call just to get the <code>totalNumberEntries</code> and proceed with the loop.</p>