I need to add values to an array of objects dynamically and pass that array variable to a function.
If I add values manually it works fine.
Object[][] listData = {{"Cheese", "Pepperoni", "Black Olives"},{"Cheese",
"Pepperoni", "Black Olives"}};
This is the function that needs to use listData .
TableModel tblModel = new DefaultTableModel(new String[]{"Date", "Action", "Amount"}, listData);
but how can I add values into listData from a for loop?
ArrayList<Map<String, Object>> sampleArray = (ArrayList)myPremiumspaid.get("Data");
for(int x =0; x<sampleArray.size(); x++)
{
//sampleArray.get(x).get("YearMonth");
//listData[][] = ""; stuck here
}
sampleArray?