Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<List<Cell>> matrix = new ArrayList<>();
- // ListOfFuckingLists Grid population version 1
- List<Cell> row1 = new ArrayList<>(1);
- row1.add(new Cell(false));
- row1.add(new Cell(false));
- row1.add(new Cell(false));
- matrix.add(row1);
- List<Cell> row2 = new ArrayList<>(2);
- row2.add(new Cell(false));
- row2.add(new Cell(false));
- row2.add(new Cell(false));
- matrix.add(row2);
- List<Cell> row3 = new ArrayList<>(2);
- row3.add(new Cell(false));
- row3.add(new Cell(false));
- row3.add(new Cell(false));
- matrix.add(row3);
- // ListOfFuckingLists Grid population version 2
- matrix.add(Arrays.asList(new Cell(false),new Cell(false),new Cell(false)));
- // ListOfFuckingLists Grid iteration Version 1
- for (int i=0; i<matrix.size();i++){
- System.out.println(matrix.get(i));
- }
- // Finnes det en mer effektiv måte å behandle dynamiske lister på(i game of life context)??
- // slik som denne gode gamle loop i loopen
- for(int x = 0; x < rows; x++){
- for(int y= 0; y < cols; y++){
- // Do something
- }
- }
- while(iterator.hasNext()) ??
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement