Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1.  
  2. List<List<Cell>> matrix = new ArrayList<>();
  3.  
  4. // ListOfFuckingLists Grid population version 1
  5. List<Cell> row1 = new ArrayList<>(1);
  6. row1.add(new Cell(false));
  7. row1.add(new Cell(false));
  8. row1.add(new Cell(false));
  9. matrix.add(row1);
  10.  
  11. List<Cell> row2 = new ArrayList<>(2);
  12. row2.add(new Cell(false));
  13. row2.add(new Cell(false));
  14. row2.add(new Cell(false));
  15. matrix.add(row2);
  16.  
  17. List<Cell> row3 = new ArrayList<>(2);
  18. row3.add(new Cell(false));
  19. row3.add(new Cell(false));
  20. row3.add(new Cell(false));
  21. matrix.add(row3);
  22.  
  23.  
  24. // ListOfFuckingLists Grid population version 2
  25. matrix.add(Arrays.asList(new Cell(false),new Cell(false),new Cell(false)));
  26.  
  27.  
  28. // ListOfFuckingLists Grid iteration Version 1
  29. for (int i=0; i<matrix.size();i++){
  30. System.out.println(matrix.get(i));
  31. }
  32.  
  33.  
  34. // Finnes det en mer effektiv måte å behandle dynamiske lister på(i game of life context)??
  35. // slik som denne gode gamle loop i loopen
  36.  
  37. for(int x = 0; x < rows; x++){
  38. for(int y= 0; y < cols; y++){
  39. // Do something
  40. }
  41. }
  42.  
  43. while(iterator.hasNext()) ??
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement