KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the most efficient way to convert data from nested lists to an object array (which can be used i.e. as data for JTable)? List<List> table = new ArrayList<List>(); for (DATAROW rowData : entries) { List<String> row = new ArrayList<String>(); for (String col : rowData.getDataColumn()) row.add(col); table.add(row); } // I'm doing the conversion manually now, but // I hope that there are better ways to achieve the same Object[][] finalData = new String[table.size()][max]; for (int i = 0; i < table.size(); i++) { List<String> row = table.get(i); for (int j = 0; j < row.size(); j++) finalData[i][j] = row.get(j); } Many thanks!
Tags (comma-separated)
Save Edits
Cancel