title: Compare two arraylist of different types
body: <p>I have 2 array-list called assignment and person and both of different type and different sizes also. 
  Problem statement :I wanna remove items from person where person id equals assignment id,
  i hv written following Comparator.</p>
  
  <pre><code>SortedSet&lt;Map.Entry&lt;AssignmentResults, Person&gt;&gt; text = new TreeSet&lt;Map.Entry&lt;AssignmentResults, Person&gt;&gt;(
          new Comparator&lt;Map.Entry&lt;AssignmentResults, Person&gt;&gt;() {
  
              @Override
              public int compare(Entry&lt;AssignmentResults, Person&gt; lhs,
                      Entry&lt;AssignmentResults, Person&gt; rhs) {
                  // TODO Auto-generated method stub
                  int statusvalue = 0;
  
                  if (rhs.getValue().getId()
                          .equals(lhs.getKey().getId()))
                      statusvalue = 1;
  
                  return statusvalue;
              }
  
          });
  </code></pre>
  
  <p>But i m not sure how to use this to get person arraylist where all item which does not contains assignment id will be removed.plz any help will be appreciated. 
  I need logic which is robust with less complexity </p>