how to order my tuple of spark results descending order using value : <p>I am new to spark and scala. I need to order my result count tuple which is like (course, count) into descending order. I put like below</p>

<pre><code> val results = ratings.countByValue()
 val sortedResults = results.toSeq.sortBy(_._2)
</code></pre>

<p>But still its't working. In the above way it will sort the results by count with ascending order. But I need to have it in descending order. Can anybody please help me.</p>

<p>Results would be like below</p>

<pre><code>(History, 12100),
(Music, 13200),
(Drama, 143000)
</code></pre>

<p>But I need to display it like below </p>

<pre><code>(Drama, 143000),
(Music, 13200),
(History, 12100)
</code></pre>

<p>thanks</p>
