I have a .csv file with occasional missing data in 3rd column of a multiple column table. I have read it into Java using CSVReader. In wanting to clean the data first, I need to allocate "unknown" into empty positions.
List <String []> file = new ArrayList <String[]>();
try 
{
    reader = new CSVReader(new FileReader(fileM),',', '"');
    String [] nextLine; 
    while ((nextLine = reader.readNext()) != null) 
    {
        if(nextLine[2].isEmpty())
        {
            nextLine[2] = new String("unknown");
        }
        file.add(nextLine);
    }
    reader.close();
Etc, etc Java throws exception to this every time it comes to the first empty cell at nextLine[2] and won’t let me update the empty cell. I think this might be as the Array List is fixed when read in, so how do I add additional strings into specific positions. Or is there a better way to manipulate this in Java?
 
     
    