title: Compare one row of resultset with remaining all and find duplicates
body: <p>I am trying to find duplicate rows from my resultset. I have a large data in resultset, which is the best way to find duplicates from resultset? I've tried with arraylist too.</p>
  
  <pre><code>List inner=new ArrayList&lt;String&gt;();
  Connection con;
  Statement stmt;
  ResultSet rs;
  ResultSetMetaData rsmd;
  int columnNumber;
  
  try{
      Class.forName("com.mysql.jdbc.Driver");
      con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb","root","");
      stmt=con.createStatement();
      rs=stmt.executeQuery("select * from mydata_table where srno&lt;1000");
      rsmd=rs.getMetaData();
      columnNumber=rsmd.getColumnCount();
      while(rs.next()){
  
          for(int i=1;i&lt;columnNumber;i++){
              inner.add(rs.getString(i));
          }
  
     }           
     System.out.println("\n" + inner);
  
     rs.close();
     con.close();
  }catch(Exception e){
      System.out.println(e);
  } 
  </code></pre>
  
  <p>I want to compare one row with remaining rows and find duplicate rows from the list.</p>