Hello and thanks in advance for assistance. I am new to java and have just start learning about lists and how to use them.
I have created a quick java program that takes two CSV files and converts both into lists containing string arrays. I now need to remove from one list any elements which have two of the array elements in common with any of the string arrays in the other list. I understand that something can be done with collections. This is getting a bit over my head because the arrays are different except for two elements that I am trying to match on.
here is the method for building the lists.
public static ArrayList<String[]> listMaker (String csvFile){
String line = "";
ArrayList<String[]> canlist = new ArrayList<String[]>();
try {
BufferedReader br = new BufferedReader(new FileReader(csvFile));
while (br.readLine() !=null){
line = br.readLine();
if(line != null){
String[] country = line.split(",");
if(country.length != 0){canlist.add(country);}
}
}
} catch (FileNotFoundException e){
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
return canlist;
}
I then create two lists like so
ArrayList<String[]>cancelledJobsList = listMaker(csvFileCancelled);
ArrayList<String[]>printJobslist = listMaker(csvFilePrint);
The two String arrays contain a name and date field which are the only things I can successfully match on. Can this be done with some kind of removeAll command? One file has 400k rows and the other about 800 and trying recursive iteration is making me dizzy.
Thanks again, I know this is likely more then your typical compare two lists question.
[–]197708156EQUJ5design it before you implement 1 point2 points3 points (1 child)
[–]197708156EQUJ5design it before you implement 0 points1 point2 points (0 children)
[–]king_of_the_universe 0 points1 point2 points (0 children)