public void nextGeneration()
	{
		for(int i = 0; i < numRows; i++){
			for(int j = 0; j < numColumns; j++){
				neighborCounter[i][j] = countLiveNeighbors(i, j);
			}
		}
		ArrayList<Cell>cellsToAdd = new ArrayList<Cell>();
		ArrayList<Cell>cellsToRemove = new ArrayList<Cell>();
		
		//Based on the number of neighbors that are alive, calculate next generation.
		for(int i = 0; i < numRows; i++){
			for(int j = 0; j < numColumns; j++){
				int numAliveNeighbors = neighborCounter[i][j];//the number of alive neighbors
				if(cellWorld.isCellAlive(i, j)){//cell is alive
					if(numAliveNeighbors < 2 || numAliveNeighbors > 3){
						cellsToRemove.add(new Cell(false, i , j));
					}					
				} else {//cell is dead
					if(neighborCounter[i][j] == 3){
						cellsToAdd.add(new Cell(true, i, j));
					}
				}				
			}
		}		
		cellWorld.addLiveCells(cellsToAdd);
		cellWorld.removeCells(cellsToRemove);
	}