-3
我有一个电池类作为访问ArrayList的一个细胞的特定属性在Java中
public class cell {
private boolean pointerIsHere;
private boolean hurdle;
private boolean startCell;
private boolean endCell;}
现在我在另一个类grid
使这个细胞类型的双ArrayList中。 这个ArrayList的初始化是;
gameGrid(int rows,int columns){
this.rows=rows;
this.columns=columns;
this.grid=new ArrayList<List<cell>>(this.rows);
for(int i=0; i<columns; i++) {
this.grid.add(new ArrayList<cell>(this.columns));
}
}
在grid
类的方法,我需要设置startCell
作为ArrayList中的特定小区的true
。我应该如何访问特定的单元格及其属性?
写的制定者。 –
什么是double ArrayList? –
@ThorbjørnRavnAndersen我做到了。在'cell'类中。问题是访问double arrayList中的特定单元的setter。 – AghaKhan