how to initialize an arraylist of arraylist in java code example
Example: Lists inside lists in java
public class GuiTest {
public static void main(String[] args) {
List<List<Integer>> MainList = new ArrayList<List<Integer>>();
Random NewRandomNumber = new Random();
for (int i = 0; i < 10; i++) {
List<Integer> SecondList = new ArrayList<Integer>();
MainList.add(SecondList);
for (int i2 = 0; i2 < 10; i2++) {
SecondList.add(NewRandomNumber.nextInt(6));
}
}