what is ArrayList<ArrayList<Integer>> in java code example

Example 1: Lists inside lists in java

public class GuiTest {

	
	public static void main(String[] args) {
		List> MainList = new ArrayList>();
		Random NewRandomNumber = new Random();
		
		for (int i = 0; i < 10; i++) {
			List SecondList = new ArrayList();
			MainList.add(SecondList);
			for (int i2 = 0; i2 < 10; i2++) {
				SecondList.add(NewRandomNumber.nextInt(6));
			}
		}

Example 2: arraylist java methds

import java.util.ArrayList;
ArrayList myList = new ArrayList();
myList.add(0);
myList.remove(0);//Remove at index 0
myList.size();
myList.get(0);//Return element at index 0

Tags:

Misc Example