我有ArrayList
。我需要用 "," 分割这个 ArrayList 的每个元素,结果得到 ArrayList<ArrayList<String>>
. 如何正确地做到这一点?这是我尝试过的代码:
ArrayList<ArrayList<String>> list = new ArrayList<ArrayList<String>>();
try {
ArrayList<String> lines = rf.readLines(filename);
for (int i = 0; i<=lines.size(); i++){
String[] items = lines.get(i).split(",");
}
}
catch(IOException e)
{
System.out.println("Unable to create "+filename+": "+e.getMessage());
}