arraylist from arraylist java code example
Example 1: arraylist java methds
import java.util.ArrayList;
ArrayList<Integer> myList = new ArrayList<Integer>();
myList.add(0);
myList.remove(0);
myList.size();
myList.get(0);
Example 2: arraylist of arraylist
public static void main(String[] args) {
ArrayList<ArrayList<Integer>> outer = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> inner = new ArrayList<Integer>();
inner.add(100);
inner.add(200);
outer.add(inner);
inner = new ArrayList<Integer>(inner);
outer.add(inner);
outer.get(0).add(300);
System.out.println(outer);
}