title: ArrayList's indexOf() returns -1 in java
body: <p>I'm validating my List of data's from file with the data's in the database to avoid duplicate insertion in database,if duplicate exists then i want the index of that record in file,am using the below code,</p>
  
  <pre><code>List&lt;StudentMaster&gt; studentMasterListFromDB = studentMasterDao.getStudentList();
  List&lt;StudentMasterVO&gt; studentMasterListFromFile = getStudentMasterListFromFile();
  
  for(int index=0;index&lt;studentMasterListFromDB.size();index++){
      StudentMasterVO studentMasVO = new StudentMasterVO();
      StudentMaster studentMaster = studentMasterListFromDB.get(index);       
      BeanUtils.copyProperties(studentMasVO, studentMaster);      
      int indexOfexistingRec = studentMasterListFromFile.indexOf(studentMasVO);
      System.out.println("indexOfexistingRec :"+indexOfexistingRec);
  
  
  }
  </code></pre>
  
  <p>But "indexOfexistingRec" value is giving -1,not the index of the existing record index.</p>