When I compile I don't get any errors but the ArrayList<File> from the method is not getting into the main.
All the entries got added into the Folders ArrayList but it doesn't get passed into the main method.
public static ArrayList<File> Process(File aFile)
{
ArrayList<File> Folders = new ArrayList<File>();
if(aFile.isFile())
{
String filenom = aFile.getPath();
if (filenom.toLowerCase().endsWith(".java")){
Folders.add(aFile);
}
}
else if (aFile.isDirectory()) {
File[] listOfFiles = aFile.listFiles();
if(listOfFiles!=null) {
for (int i = 0; i < listOfFiles.length; i++)
Process(listOfFiles[i]);
}
else {
System.out.println(" [ACCESS DENIED]");
}
}
return (Folders);
}
public static void main(String[] args) throws IOException
{
ArrayList<File> FAddress = new ArrayList<File>();
File dir = new File("C:/");
FAddress = Process(dir);
if (FAddress.isEmpty())
System.out.println("WTF?!");
else{
for (File fl : FAddress) {
String FileAddress = fl.getName();
System.out.println(FileAddress);
}
}
}