title: Find Missing items from arraylist in java
body: <p>Hi I am newbie to java and was trying my hand on collections part, I have a simple query
  I have two array list of say employee object </p>
  
  <pre><code>class Employee
  {
      private int emp_id;
      private String name;
      private List&lt;String&gt; mobile_numbers;
  
      //.....getters and setters
  }
  </code></pre>
  
  <p>say <code>listA</code> and <code>listB</code> have the following data</p>
  
  <pre><code>    List&lt;Employee&gt; listA = new ArrayList&lt;Employee&gt;(); 
      List&lt;Employee&gt; listB = new ArrayList&lt;Employee&gt;(); 
  
      listA.add(new Employee("101", "E1", listOfMobileNumbers));
      listA.add(new Employee("102", "E2", listOfMobileNumbers1));
      listA.add(new Employee("103", "E3", listOfMobileNumbers2));
      listA.add(new Employee("104", "E4", listOfMobileNumber4));
      listA.add(new Employee("105", "E5", listOfMobileNumbers5));
  
      listB.add(new Employee("101", "E1", listOfMobileNumbers1));
      listB.add(new Employee("102", "E2", listOfMobileNumbers2));
      listB.add(new Employee("106", "E6", listOfMobileNumber6));
      listB.add(new Employee("107", "E7", listOfMobileNumber7));
      listB.add(new Employee("108", "E8", listOfMobileNumbers8));
  </code></pre>
  
  <p>where <code>listOfMobileNumbers</code> is a <code>List&lt;String&gt;</code></p>
  
  <p>Now I want to find the additional elements from the individuals list.
  i.e </p>
  
  <pre><code> List&lt;Employee&gt; additionalDataInListA = new ArrayList&lt;Employee&gt;(); 
      // this list should contain 103, 104 and 105
  
    List&lt;Employee&gt; additionalDataInListB= new ArrayList&lt;Employee&gt;(); 
      // this list should contain 106, 107 and 108               
  </code></pre>
  
  <p>How do i achieve this?</p>
  
  <p>Your help is appreciated.</p>
  
  <p>Edit:</p>
  
  <p>I don't want to use any internal functions i want to achieve it writing some manual function kind of comparison function.</p>
  
  <p>I also cant override the equals function because the in my usecase i have <strong>FieldNo</strong> which is int and <strong>Values</strong> which is a <code>List&lt;String&gt;</code>.</p>
  
  <p>the occurrences of field is 'n' times and every time the Values associated with that field will different.</p>
  
  <p>For example :
  FieldNo=18
  Values=["A"];</p>
  
  <p>FieldNo=18
  Values=["B"];
  <em>and so on...</em></p>
  
  <p>The employee id that I had used was for only illustration purposes where it makes sense to override equals and hash code.</p>