I try to set data from list to two multidimensional array. Normally I can set data to two multidimensional array like this:
Object[][] newData = {
{ "test", "test2", 15.98, 0.14, "+0.88%",
32157250 },
{ "AAPL", "Apple Inc.", 126.57, -1.97, "-1.54%", 31367143 }"
However I want to set data dynamically from list . I have a method which returns a list:
List<User> user = listUser(id);
static User {
private int id;
private String name;
and getter(...),setter(..).
I need to set user from listUser(id) method to Object[][] array.
I try to do it but I couldn't get succesful result:
for (int i=0;i<user.size();i++){
for(int j=0;j<user.size();j++){
newData[i][j]=user.get(i).getName();
}
}
Could you help me?