title: Order object by id in the same order as the ids list
body: <p>I have list of integer IDs. Lets say this list is <code>ArrayList&lt;Integer&gt;</code> or int[], it doesn't matter. I have another <code>ArrayList&lt;Obj&gt;</code> that contains the objects with the same ids like in the first list, but they are ordered in different order.</p>
  
  <p><strong>I want to order the objects in the second list in the order as the ids in the first list.</strong></p>
  
  <p><strong>EXAMPLE:</strong></p>
  
  <pre><code>FIRST LIST:  { 1, 5, 4, 8, 6 }
  SECOND LIST: { Obj[id=5], Obj[id=8], Obj[id=6], Obj[id=1], Obj[id=4] }
  
  RESULT LIST: { Obj[id=1], Obj[id=5], Obj[id=4], Obj[id=8], Obj[id=6] }
  </code></pre>
  
  <p>Can someone tell me an (efficient) way to do this?</p>