title: Comparing the elements of an arrayList with one another
body: <p>I have an array list with four object elements in it and i need to compare these objects with each other. I need to avoid the similar object comparisons and doing a continue in case if both objects are same. I have tried the below code but it's avoiding the common object iterations. Can anyone suggest me a best way to compare the elements in the same Array list?</p>
  
  <p>Code:</p>
  
  <pre><code>List&lt;Student&gt; studentInfo= new ArrayList&lt;Student&gt;();
  
   for (int i = 0; i &lt; list.size(); i++)
              {
                  for (int j = 0 ; j &lt; list.size(); j++)
                  {
  
  
                      if(list.get(i).getstudentId().equals(list.get(j).getstudentId())) 
                      continue;
  
                      }
  
                  }
  
              }
  </code></pre>