title: How to order a list of objects (mix cocktail) in scala
body: <p>I'm a little confused with lists ordering in Scala.</p>
  
  <p>I want to indicate how a list should be mixed. For example I have a list of numbers. These numbers have a letter. I want to order these numbers by a pattern of letters.</p>
  
  <pre><code>val numbers = List((1, "a"), (2, "b"), (3, "a"), (4, "a"), (5, "b"), (6, "a"), (7, "a"))
  // order pattern
  val cocktail = List("a", "b", "a", "b") 
  // Expected output: 1, 2, 3, 5 
  
  val cocktail2 = List("a", "a", "a", "b") 
  // Expected output: 1, 3, 4, 2 
  </code></pre>
  
  <p>Please any suggest?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks for the fast replies. all is working now!</p>