title: Scala using toSet.toList vs distinct
body: <p>If I want to get the unique elements of in a List I can either do a <code>distinct</code> or call <code>toSet.toList</code>. Which is more efficient and why ? Is there any other efficient way of doing this ? My understanding is that <code>distinct</code> will also maintain the order whereas <code>toSet.toList</code> won't. </p>
  
  <pre><code>scala&gt; val mylist = List(1,2,3,3,4,4,4,5,6,6,6,6,7)
  mylist: List[Int] = List(1, 2, 3, 3, 4, 4, 4, 5, 6, 6, 6, 6, 7)
  
  scala&gt; mylist.distinct
  res11: List[Int] = List(1, 2, 3, 4, 5, 6, 7)
  
  scala&gt; mylist.toSet.toList
  res12: List[Int] = List(5, 1, 6, 2, 7, 3, 4)
  </code></pre>