2个回答
2013-04-19
展开全部
请直接调用这个函数: static String[] convert(List<String[]> from) {
ArrayList<String> list = new ArrayList<String>();
for (String[] strings : from) {
Collections.addAll(list, strings);
}
return list.toArray(new String[list.size()]);
}
【以下是如何调用这个函数的例子】public static void main(String[] args) {
List<String[]> list = new ArrayList<String[]>();
list.add(new String[] { "one", "two" });
list.add(new String[] { "three", "four", "five" });
list.add(new String[] { "six", "seven" });
String[] converted = convert(list);
System.out.print(converted.toString());
}
ArrayList<String> list = new ArrayList<String>();
for (String[] strings : from) {
Collections.addAll(list, strings);
}
return list.toArray(new String[list.size()]);
}
【以下是如何调用这个函数的例子】public static void main(String[] args) {
List<String[]> list = new ArrayList<String[]>();
list.add(new String[] { "one", "two" });
list.add(new String[] { "three", "four", "five" });
list.add(new String[] { "six", "seven" });
String[] converted = convert(list);
System.out.print(converted.toString());
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询