title: retainAll() for Arraylist<CustomClass>() of custom class not working
body: <p>I am trying to use retainAll() for Arraylist of custom class that I have defined. But the resulting arraylist does not contain any value, it becomes empty. Here is the code given below.</p>
  
  <pre><code>ArrayList&lt;AllBrandsData&gt; check = new ArrayList&lt;AllBrandsData&gt;(database.getBrandsForGivenKeyword(searchBrand, Brand_Type.Brand));
  
  ArrayList&lt;AllBrandsData&gt; check2 = new ArrayList&lt;AllBrandsData&gt;(brands);
  
  Boolean status = check2.retainAll(check);
  
  System.out.println("Sizes are --&gt; " + check2.size() + " &amp; " + check.size() + " Status is --&gt; " + status);
  </code></pre>
  
  <p>white printing out the check2 size comes out to be zero.
  Any help is appretiaited. </p>
  
  <p>P.S - check and check2 are having data in them and they do share some common data. </p>