title: Spark: sort the list by string
body: <p>In the below code I am able to arrange the list by "sortByKey".
   However, requirement is to sort by string in alphabetical orders. </p>
  
  <p>That is expected output should be:</p>
  
  <pre><code>Array((3,book),(2,cat),(7,cup),(5,heater),(6,mouse),(1,screen),(4,tv)) 
  </code></pre>
  
  <p><br/></p>
  
  <pre><code>scala&gt; val randRDD = sc.parallelize(List( (2,"cat"), (6, "mouse"),(7, "cup"), (3, "book"), (4, "tv"), (1, "screen"), (5, "heater")), 3)
  randRDD: org.apache.spark.rdd.RDD[(Int, String)] = ParallelCollectionRDD[0] at parallelize at &lt;console&gt;:27
  
  scala&gt; randRDD.collect
  res0: Array[(Int, String)] = Array((2,cat), (6,mouse), (7,cup), (3,book), (4,tv), (1,screen), (5,heater))
  
  scala&gt; randRDD.sortByKey().collect
  res1: Array[(Int, String)] = Array((1,screen), (2,cat), (3,book), (4,tv), (5,heater), (6,mouse), (7,cup))
  </code></pre>