Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. List<List<Cell>> matrix = new ArrayList<>();
  2.  
  3. List<Cell> row1 = new ArrayList<>(1);
  4. row1.add(new Cell(false));
  5. row1.add(new Cell(false));
  6. row1.add(new Cell(false));
  7.  
  8. matrix.add(row1);
  9.  
  10. List<Cell> row2 = new ArrayList<>(2);
  11. row2.add(new Cell(false));
  12. row2.add(new Cell(false));
  13. row2.add(new Cell(false));
  14.  
  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.  
  22. matrix.add(row3);
  23.  
  24. System.out.println();
  25.  
  26. matrix.add(Arrays.asList(new Cell(false),new Cell(false),new Cell(false)));
  27.  
  28.  
  29.  
  30.  
  31. System.out.println("Size = "+ matrix.size());
  32.  
  33. for (int i=0; i<matrix.size();i++){
  34. System.out.println(matrix.get(i));
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement