Arraylist1有Apple和banana(2件物品) Arraylist2有芒果和葡萄(2项)
放置在地图中
Map<String, List<testdata>> x
x.put("a" ,Arraylist1 )
x.put("b" , Arraylist2)
现在我要打印如下 Apple \ n 芒果\ n 香蕉\ n 葡萄\ n
答案 0 :(得分:0)
List<String> combinedList = new ArrayList<String>();
combined.addAll(Arraylist1);
combined.addAll(Arraylist2);
for(int j = 0; j < combinedList.size(); j++)
System.out.print(combinedList.get(j) + " \\n ");