我知道递归的基础知识,但在给定的代码中,我很难理解流程。
请帮帮我...
public ArrayList<String> searchFolders(File fo) {
if (fo.isDirectory()) {
String internalNames[] = fo.list();
for (int i = 0; i < internalNames.length; i++) {
searchFolders(new File(fo.getAbsolutePath() + "\\"+ internalNames[i]));
path = fo.getAbsolutePath() + "\\" + internalNames[i];
}
}
if (fo.isFile()) {
alist.add(fo.toString());
}
return alist;
}