title: Efficient way to order a Java list based on another list
body: <p>I have 2 lists for my application. ListA - {id, address, name} ListB - {address}</p>
  <p>ListB is sorted based on user input.</p>
  <pre><code>ListA - {{1, {id:1, street:&quot;abc&quot;}, personA},
  {2, {id:2, street:&quot;def&quot;}, personB},
  {3, {id:3, street:&quot;ghi&quot;}, personC},
  {4, {id:4, street:&quot;jk&quot;}, personD}}
  
  ListB - {
  {id:3, street:&quot;ghi&quot;},
  {id:2, street:&quot;def&quot;}
  {id:4, street:&quot;jk&quot;},
  {id:1, street:&quot;abc&quot;}
  }
  
  RESULT After LISTA is sorted
  LISTA - {{3, {id:3, street:&quot;ghi&quot;}, personC},
  {2, {id:2, street:&quot;def&quot;}, personB},
  {4, {id:4, street:&quot;jk&quot;}, personD}},
  {1, {id:1, street:&quot;abc&quot;}, personA},
  </code></pre>
  <p>I can do</p>
  <pre><code>List&lt;&gt; orderedList = new arraylist()&lt;&gt;;
  ListB.forEach(address -&gt; {
   orderedList.add(ListA.stream.filter(pers -&gt; pers.getAddress.equals(address)).findFirst().get());
  }
  </code></pre>
  <p>Is there more efficient way to do so?</p>