title: Comparing two object lists using one of the object atributes
body: <p>I have two object lists that needs to be compared. The objects have the name atribute and i'd like to check if one object with that name, is present in the other list.</p>
  
  <p>I've came across the ListUtils.subtract method, but i've only seen people using it with types like Int or String...</p>
  
  <p>Can it be used with custom object types?</p>
  
  <p>EDIT:</p>
  
  <pre><code>Myclass{
      private String name;
      public getName(){
          return this.name;
      }
  
  }
  </code></pre>
  
  <p>I have two lists of this object type:</p>
  
  <pre><code>List&lt;MyClass&gt; list1;
  List&lt;MyClass&gt; list2;
  </code></pre>
  
  <p>One of these lists is created with some sql queries. The other one is created checking some files in a server. The number of objects in these lists could be the same, or one or the other could have more objects.</p>
  
  <p>Is there a way to get the objects that are in one list, but not in the other list?</p>
  
  <p>Something like this: </p>
  
  <pre><code>List result = ListUtils.subract (list1,list2);
  </code></pre>
  
  <p>But using the name atribute.</p>