-3
Как преобразовать int[]
в класс Cell
?как новый класс java как int [] тип
public List<int[]> getThem(List<int[]> theList) {
List<int[]> list1 = new ArrayList<int[]>();
for (int[] x : theList)
if (x[0] == 4)
list1.add(x);
return list1;
}
Я хочу, чтобы реорганизовать следующим образом:
public List<Cell> getFlaggedCells() {
List<Cell> flaggedCells = new ArrayList<Cell>();
for (Cell cell : gameBoard)
if (cell.isFlagged())
flaggedCells.add(cell);
return flaggedCells;
}
Как я могу сделать класс Cell
в int[]
?