title: How do I sort a collection of Lists in lexicographic order in Scala?
body: <p>If <code>A</code> has the <code>Ordered[A]</code> trait, I'd like to be able to have code that works like this</p>
  
  <pre><code>val collection: List[List[A]] = ... // construct a list of lists of As
  val sorted = collection sort { _ &lt; _ }
  </code></pre>
  
  <p>and get something where the lists have been sorted in lexicographic order. Of course, just because <code>A</code> has the trait <code>Ordered[A]</code> doesn't mean that <code>List[A]</code> has the trait <code>Ordered[List[A]]</code>. Presumably, however, the 'scala way' to do this is with an implicit def.</p>
  
  <p><strong>How do I implicitly convert a <code>List[A]</code> to a <code>Ordered[List[A]]</code>, assuming A has the trait <code>Ordered[A]</code> (so that the code above just works)?</strong></p>
  
  <p>I have in mind using the lexicographic ordering on <code>List[A]</code> objects, but I'd like code that can be adapted to others orderings.</p>