title: best way to paginate?
body: <p>I have a list of items, and I need to call a function with at most 30 of them each time. Here's what I'm doing:</p>
  
  <pre><code>final int maxItemsPerRequest = 30;
  List&lt;Item&gt; itemsToProcess = new ArrayList&lt;&gt;();
  for (Item item : itemsList) {
      itemsToProcess.add(item);
  
      if (itemsToProcess.size() % maxItemsPerRequest == 0) {
          processItem(itemsToProcess);
          itemsToProcess = new ArrayList&lt;&gt;();
      }
  }
  if (itemsToProcess.size() &gt; 0)
      processItem(itemsToProcess);
  </code></pre>
  
  <p>I feel this last check (.size() > 0) smells a bit.</p>
  
  <p>Any recommendation on another way to do it?</p>