title: Compare two list and output missing and extra element in Java
body: <p>I have two lists of strings List A and B.Lists might have same length or maybe one is longer than the other.There's no duplicate values in each list.They consist of random numbers.</p>
  
  <p>What I want to do is to find the missing and the extra element exists in A compared to list B.And save them in two new lists , one for missing elements and one for extra elements.</p>
  
  <p>For Example : </p>
  
  <pre><code>A = ["3000047" , "3000042" , "3000030"  , "30000475"]
  
  B = ["3000047" , "3000043" , "3000030" ]
  </code></pre>
  
  <p>The output should be </p>
  
  <pre><code>Missing = ["3000043"]
  
  Extra = ["3000042" , "30000475"]
  </code></pre>
  
  <p>I think of doing at as below. But not sure about the performance and its efficiency.</p>
  
  <ol>
  <li>Read element from A.</li>
  <li>Check if element exists in B.</li>
  <li>If no add it to Extra list.</li>
  <li>If yes remove the element from both A and B.</li>
  <li>If B is empty add all renaming elements in Extra list.</li>
  <li>If A is empty add all renaming elements in Missing list.</li>
  </ol>