这里只写出了ArrayList的自身嵌套,其他的嵌套没有写
举例说明:
import java.util.ArrayList;
import com.fenqing.s.person;
public class ArrayListAndArraList {
public static void main(String[] args) {
ArrayList<ArrayList<person>> l = new ArrayList<ArrayList<person>>();
ArrayList<person> f =new ArrayList<person>();
f.add(new person("aa",1));
f.add(new person("bb",2));
f.add(new person("cc",3));
ArrayList<person> s=new ArrayList<person>();
s.add(new person("dd",4));
s.add(new person("ee",5));
s.add(new person("ff",6));
l.add(f);
l.add(s);
for (ArrayList<person> ap : l) {
for(person p:ap){
System.out.println(p);
}
}
}
}