How to read an array from columns in Java? -


i have .csv file 177 rows , 18,000 odd cols.given column label, should pick particular column , default first 2 label columns.

please me this,

thanks all,

priya

so, what's question? parse csv file. can either implement or use third party code. if implement read line line, split lines line.split(",") elements , put data structure should map of lists:

map<string, list<string>> table = new linkedhashmap<string, list<string>>(); 

use column name key , column values list elements. linkedhashmap preferable here preserve order of columns.

read first line contains column names , create list instances:

table.put(columnname, new linkedlist<string>()); 

additionally create array of column names:

string[] columns = new string[0]; table.keys().toarray(); 

now continue iterating on data , populate table:

string[] data = line.split(","); (int = 0;  < data.length;  i++) {     table.get(columns[i]).add(data[i]); } 

tbd... luck.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -