I am trying to read a csv file and copy it's data into an array. I can't seem to get it to work this way and I'm not sure why.
String[] row = new String[0];
ArrayList<String[]> csv = new ArrayList<>();
String parser = "SPImages";
CSVReader reader = new CSVReader(new FileReader("C://data.csv"));
String[] nextLine;
while ((nextLine = reader.readNext()) != null){
System.arraycopy(nextLine, 0, row, 0, nextLine.length);
}
row? In fact, what's its type?rowrowmust have at least the size of thenextLine.length!rowis big enough for the arraycopy, you will overwrite the content with each loop iteration.