title: RxJava: Window on count or timespan without dropping elements
body: <p>I want to divide my stream in batches of a certain maximum size, and if this size isn't reached after a while close the batch and start a new one.
  For that I tried using window(count):</p>
  
  <pre><code>things.window(10)
  </code></pre>
  
  <p>However this waits until 10 elements are received to emit a new Observable window.
  If I use the window(timespan, unit, count) operator:</p>
  
  <pre><code>things.window(1, TimeUnit.SECONDS, 10)
  </code></pre>
  
  <p>I will loose all the elements that came after the 10th and before the timespan is completed.</p>
  
  <p>I'd like a similar operator that instead of waiting for the timespan to complete emit a new window when the count is reached.</p>
  
  <pre><code>things.windowXXX(timespan = 1s, count = 2) : Observable[T]
  
  things:   ----o--o--o-----------o----o-------&gt;
  timespan: [      )[    1s    ][      )[    --&gt;
  window 1: -----o-o-|
  window 2:          -o---------|
  window 3:                     --o-----o-| 
  </code></pre>