I am having a resultList
which is a string list were each element in this list is also a List<String>
. Now I want to put my data into a csv sheet. For that I am using opencsv.
List<String[]> data = new ArrayList<String[]>();
for(int m = 0; m < resultList.get(0).size(); m++) {
for (int i = 0; i < resultList.size(); i++) {
data.add(new String[] {resultList.get(i).get(m).toString()});
}
}
writer.writeAll(data);
//close Writer
writer.close();
My data should look like that:
However, my implementation gives me that:
In my implementation I am taking, knowing that every sublist has the same length, from each sublist the first element and add it to the array. Why am I getting this long row?
I appreciate your replies!