title: Sort list of objects by list of integers
body: <p>I have a list of integers (it's called L1): {14,16,12}</p>
  
  <p>and I have a list of objects (L2):</p>
  
  <pre><code>{
      [name: 'a1', id: 5], 
      [name: 'a2', id: 16],
      [name: 'a2', id: 8],
      [name: 'a2', id: 14]
  }
  </code></pre>
  
  <p>I want to order L2 according to the order of L1.</p>
  
  <p>I tried:</p>
  
  <pre><code>L2.OrderBy(Function(o) L1.IndexOf(o.id)).ToArray()
  </code></pre>
  
  <p>But I got:</p>
  
  <pre><code>{
      [name: 'a1', id: 5],
      [name: 'a2', id: 8],
      [name: 'a2', id: 14],       
      [name: 'a2', id: 16]
  }
  </code></pre>
  
  <p>It happens because 5 and 8 are not found in L1, that's why <code>indexOf</code> returns -1.</p>
  
  <p>How Can I sort it by the list and preserve the other items in L2 that are not found in L1 in the same order?</p>
  
  <p><strong>Update:</strong>
  The output should be:
  14,
  16,
  5,
  8</p>
  
  <p>The steps:</p>
  
  <pre><code>step 1)
  
  L1 -&gt; first number is 14.
  put 14 in the top:
  
  14, 5, 16, 8. 
  
  step 2)
  
  L1 -&gt; second number is 16.
  put 16 in the top (after 14):
  
  14, 16, 5, 8. 
  
  step 3)
  L1 -&gt; third number is 12.
  12 is not found in L2.
  
  So the output is: 14, 16, 5, 8.
  </code></pre>
  
  <p>Any help appreciated!</p>