I have a csv file with headers in order fname,mname,lname and a csv parser to parse this. I am reading the file line by line and splitting by delimitter (",") and according to index i'll get the values 0=fname, 1=mname, 2=lname.
Now again if a csv comes with headers in the order lname,fname and mname i have to change the code again. I want to write a generic parser which regardless of the order of the header stores the value in respective fields. Any suggestions?
Arraylist<String>read the line by line .. when you look forfname, get the index of it from the arraylist then you will know the index of the stored data. Agian that's just a hack. Personally create yourself an object for each Line with the appropriate headers as your deal with each line .