I have this code, which supposed to retrieve data from CSV file, the file (set of files) structure is as following: [Mary, 7, 17] but the columns are not titled, so I only got A, B, C when I run the code I seem to have only the first result in the column. can anybody help me to iterate throw all records?
public void searchFiles()
{
int count = 0;
DirectoryResource c = new DirectoryResource();
int summ = 0;
int currentrow = 0;
String name = "ff";
String k = "Susan";
for(File f : c.selectedFiles())
{
FileResource fr = new FileResource(f);
CSVParser currentFile = fr.getCSVParser(false);
currentrow = 0;
for (CSVRecord row : currentFile)
{
currentrow++;
name = row.get(0);
if(row.get(0) == k)
{
count++;
summ = summ + currentrow;
System.out.println("Row is : " + row.getRecordNumber() + " / " + currentrow);
break;
}
else
{
System.out.println("found");
}
}
System.out.println(count + " / " + currentrow + " / " + name);
}
System.out.println("count is: " + count);
System.out.println("Summ is: " + summ);
System.out.println("Avg is: " + (summ / count));
}