My purpose is to compare two list from excel and delete those those that are non duplicates. Here in my code I first add the second list to the first. Then I want to loop trough the first to identify each element , in the same loop i want to pick use the first element that i Identified to loop trough again the whole list to see if it can find any duplicate of it and if it finds it add it to a new list. And in the end i want to delete the two list and save the new one so I have a fresh with all the duplicate numbers.
public void compareLists(){
getOutCells1().addAll(getOutCells2());
for(int i =0;i<getOutCells1().size();i++){
getOutCells1().get(i);
for( int e=0;e<getOutCells1().size();e++){
getOutCells1().get(e);
if(getOutCells1().get(e)==getOutCells1().get(i)){
System.out.print(getOutCells1().get(e)+" ");
}
}
}
}
Using:
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;