title: Compare 2 list with different object java return unmatched list
body: <p>How to compare 2 list
  ArrayList with List</p>
  <p>ArrayList list = {a,b,c,d}
  and
  List lst = {a,b,c,d,e}</p>
  <p>result:
  List al = {e}</p>
  <p>How should I approach this problem?
  As Objects are different the comparator does not work, even set or other operation will not work</p>
  <pre><code>    List&lt;String&gt; al = null;
      Map&lt;String, List&lt;String&gt;&gt; tagMap = new HashMap&lt;String, List&lt;String&gt;&gt;();
      for (TkMGroup anotherTest : lst) {
          String id = anotherTest.getGrpCd();
          for (CsvGroup tag : list) {
              if (id.equals(tag.getGrpCd())) {
                  if (tagMap.containsKey(id)) { // is this `id` already populated?
                      al = tagMap.get(id);
                  } else { // No! Create a new List.
                      al = new ArrayList&lt;String&gt;();
                      tagMap.put(id, al);
                  }
                  // Add the tag to the List.
                  al.add(tag.getGrpCd());
              } else {
                  //              al.add(id);
              }
          }
      }
      for (int i = 0; i &lt; al.size(); i++) {
          System.out.println(al.get(i));
      }
  </code></pre>