title: Scala - sort based on Future result predicate
body: <p>I have an array of objects I want to sort, where the predicate for sorting is asynchronous. Does Scala have either a standard or 3rd party library function for sorting based on a predicate with type signature of <code>(T, T) -&gt; Future[Bool]</code> rather than just <code>(T, T) -&gt; Bool</code>?</p>
  
  <p>Alternatively, is there some other way I could structure this code? I've considered finding all the 2-pair permutations of list elements, running the predicate over each pair and storing the result in a <code>Map((T, T), Bool)</code> or some structure to that effect, and then sorting on it - but I suspect that will have many more comparisons executed than even a naive sorting algorithm would.</p>