1public class GuiTest {
2
3
4 public static void main(String[] args) {
5 List<List<Integer>> MainList = new ArrayList<List<Integer>>();
6 Random NewRandomNumber = new Random();
7
8 for (int i = 0; i < 10; i++) {
9 List<Integer> SecondList = new ArrayList<Integer>();
10 MainList.add(SecondList);
11 for (int i2 = 0; i2 < 10; i2++) {
12 SecondList.add(NewRandomNumber.nextInt(6));
13 }
14 }
1import java.util.ArrayList;
2ArrayList<Integer> myList = new ArrayList<Integer>();
3myList.add(0);
4myList.remove(0);//Remove at index 0
5myList.size();
6myList.get(0);//Return element at index 0
1public static void main(String[] args) {
2 ArrayList<ArrayList<Integer>> outer = new ArrayList<ArrayList<Integer>>();
3 ArrayList<Integer> inner = new ArrayList<Integer>();
4
5 inner.add(100);
6 inner.add(200);
7 outer.add(inner); // add first list
8 inner = new ArrayList<Integer>(inner); // create a new inner list that has the same content as
9 // the original inner list
10 outer.add(inner); // add second list
11
12 outer.get(0).add(300); // changes only the first inner list
13
14 System.out.println(outer);
15}