如何声明二维字符串数组列表? [英] How do I declare a 2D String arraylist?
本文介绍了如何声明二维字符串数组列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做这样的事情 ArrayList
我如何创建它?
如何添加到外部和内部列表
How can I add to the external and internal list
以及如何将内部列表转换为简单的数组列表?
and how can I convert the internal list to a simple array list?
推荐答案
你可以一起去
List<List<String>> ls2d = new ArrayList<List<String>>();
List<String> x = new ArrayList<String>();
x.add("Hello");
x.add("world!");
ls2d.add(x);
System.out.println(Arrays.deepToString(ls2d.toArray()));
这篇关于如何声明二维字符串数组列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文