title: Making Combinations of Elements in ArrayList [Kotlin]
body: <p>I have the an ArrayList of elements which I need to get Combinations of pairs.</p>
  
  <p>eg. <code>[A, B, C]</code> will be converted to <code>[[A, B], [A, C], [B, C]]</code></p>
  
  <p>I currently use the normal way of achieving this</p>
  
  <pre><code>for(i in 0 until arr.size-1)
      for(j in i+1 until arr.size)
          //do stuff with arr[i], arr[j]
  </code></pre>
  
  <p>and If I need combinations of more than two elements I'll probably write a recursive function to do the same. My concern is that this method is still old-school &amp; might be not as Functional-Kotlin like</p>
  
  <p>Is there a better way to achieve this &amp; also for more number of elements in combination without going into recursion?</p>