title: Split a list into three in Kotlin
body: <p>I have the following data class:</p>
  <pre><code>data class Foo(val a: Int = 0, val b: Int = 0)
  </code></pre>
  <p>I have a list of <code>Foo</code>'s with the following structure:</p>
  <pre><code>[ Foo(a = 1), Foo(a = 2), ..., Foo(b = 22), Foo(a = 5), Foo(a = 6), ... ]
  </code></pre>
  <p>(a group of items with <code>a</code>'s, then one <code>b</code>, then <code>a</code>'s again)</p>
  <p>I would like to split above list into three sub-lists like that:</p>
  <ol>
  <li><code>[ Foo(a = 1), Foo(a = 2), ...]</code></li>
  <li><code>[ Foo(b = 22) ]</code></li>
  <li><code>[ Foo(a = 5), Foo(a = 6), ...]</code></li>
  </ol>
  <hr />
  <ol>
  <li>sublist of elements that have non-zero <code>a</code> property</li>
  <li>list of one element that has non-zero <code>b</code></li>
  <li>remaining sublist of elements that have non-zero <code>a</code> property</li>
  </ol>
  <p>Is it possible to achieve using <code>groupBy</code> or <code>partition</code>?</p>