title: Create Sets from a Set based on Time Differences
body: <p>let’s say I have a collection of <code>Logs</code> and I want to create different collections based on date ranges. For example, if the collection had 4 items.</p>
  
  <pre><code>logs[0].dateCreated = 12:00
  logs[1].dateCreated = 12:10
  logs[2].dateCreated = 12:50
  logs[3].dateCreated = 12:60
  </code></pre>
  
  <p>I want items 0-1 in a Set and then put 2-3 in a Set. The criteria being within 30 seconds of one another. My psuedo code idea is:</p>
  
  <pre><code>logs.forEach(item -&gt; { 
    // if on first item, just put it in the first collection
    // store this item as the initial time diff
    // if the next item is within 30 seconds, add to same colletion
    // otherwise, add  item to new collection, this item now becomes the time diff
    // rinse and repeat.
  });
  </code></pre>
  
  <p>Wondering if there is a better/more efficient way.</p>