title: Spark sort by key and then group by to get ordered iterable?
body: <p>I have a Pair RDD <code>(K, V)</code> with the key containing a  <code>time</code> and an <code>ID</code>. I would like to get a Pair RDD of the form <code>(K, Iterable&lt;V&gt;)</code> where the keys are groupped by id and the iterable is ordered by time.</p>
  
  <p>I'm currently using <code>sortByKey().groupByKey()</code> and my tests seem to prove it works, however I'm reading that it may not always be the case, as discussed in this question with diverging answers ( <a href="https://stackoverflow.com/questions/24206660/does-groupbykey-in-spark-preserve-the-original-order">Does groupByKey in Spark preserve the original order?</a> ).</p>
  
  <p>Is it correct or not?</p>
  
  <p>Thanks!</p>