-1
我被给了一些伪代码来让我去,但我无法弄清楚它全部。扩展被赋给变量“分机”递归地显示具有特定扩展名的所有文件
If f.isFile() is true, then
If f.getPath() ends with the extension, then
Add f.getPath() to the foundFiles array list
Return // this is the end of recursion
Else // This must be a directory
For each subFile in f.listFiles() // This gets all the files in the directory
Call findMatchingFiles(subFile) // This is the recursive call
这是我迄今为止,并似乎无法填补空白。任何提示或帮助非常感谢。
public void findMatchingFiles(File f) {
if (f.isFile() == true) {
if() {
foundFiles.add(f.getPath());
}
return;
} else {
for (:) {
findMatchingFiles(subFile);
}
}
}
}