java - how to convert Vector<Vector<String>> to Object [] []? -
i have dinamical sorter jtable problem is working object [][] data mine data in format
vector<vector<string>> data;
and guess need cast object
object [] []
i'm guessing need make double statement iterate , put object variable. can me issue?
with java 7 or earlier, you'd have this:
int n = data.size(); object[][] arr = new object[n][]; (int = 0; < n; i++) arr[i] = data.get(i).toarray();
with java 8 can in 1 line:
object[][] arr = data.stream().map(list::toarray).toarray(object[][]::new);
Comments
Post a Comment