+ 1

Can we nest arraylist?

Can we nest arraylist? if yes can any one give me an example of it?

14th Mar 2017, 3:49 PM
Ratnadeep Dey
Ratnadeep Dey - avatar
1 ответ
+ 5
ArrayList<ArrayList<String>> all = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); al.add("a"); all.add(al); ArrayList<String> al2 = new ArrayList<>(); al2.add("b1"); al2.add("b2"); all.add(al2); System.out.println(all);
14th Mar 2017, 4:11 PM
Tamás Barta
Tamás Barta - avatar