I have ArrayList. I need split each element of this ArrayList by "," and as result got ArrayList<ArrayList<String>>. How to do it properly?
This is code I have tried:
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());
}
String[]into anArrayList<String>. You can use theArrays#asListmethod to continue solving your problem.i < lines.size(), not<=