I am trying to figure out which best approach would be to parse a csv file in Java. Now each line will contain X information. For example, the first line can contain up to 5 string words (with commas separating them), while in the next few lines there may be 3 or 6 or something else.
My problem is not reading the lines from the file . Just to be clean. My problem is that the data structure is best to hold every line as well as every word in that line?
At first I thought about using a 2D array, but the problem is that the dimensions of the array should be static (the second index size will contain the number of words in each row, which may differ from row to row),
Here are the first few lines of the CSV file:
0,MONEY
1,SELLING
2,DESIGNING
3,MAKING
DIRECTOR,3DENT95VGY,EBAD,SAGHAR,MALE,05/31/2011,null,0,10000,07/24/2011
3KEET95TGY,05/31/2011,04/17/2012,120050
3LERT9RVGY,04/17/2012,03/05/2013,132500
3MEFT95VGY,03/05/2013,null,145205
DIRECTOR,XKQ84P6CDW,AGHA,ZAIN,FEMALE,06/06/2011,null,1,1000,01/25/2012
XK4P6CDW,06/06/2011,09/28/2012,105000
XKQ8P6CW,09/28/2012,null,130900
DIRECTOR,YGUSBQK377,AYOUB,GRAMPS,FEMALE,10/02/2001,12/17/2007,2,12000,01/15/2002