private void undo() { if (steps.isEmpty()) { logger.warn("There is nothing to undo."); return; } Step step = steps.pop(); Set<Integer> groupIds = board.undo(step); // update all affected group sum view for (int groupId : groupIds) { updateGroupSumView(groupId); } // update all cell view for (CellSnapshot snapshot : step.snapshots) { Cell cell = board.getCell(snapshot.row, snapshot.col); boardView.updateCellView(cell); } }