public class Build_Cells extends Loop {
private List<List<Cell>> map = new ArrayList<List<Cell>>();
public Build_Cells(){
}
public Build_Cells( int height, int width , int cell_size ){
int col = height / cell_size;
int rows = width / cell_size;
for( int y = 0; y < col ; y++){
map.add(y, new ArrayList<Cell>(rows));
}
}
};
In the last line of code: map.add(y, new ArrayList(rows)); I want it to run Cell's constructor Cell() for every element in the ArrayList (rows) - but how do I do that?