import java.io.File;
import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * Created by Vol4ica on 14.06.2015.
 */
public class DirectoryList implements Callable<ArrayList<String>> {


    public ArrayList<String> call(File parent) {
        File[] files = parent.listFiles();
        ArrayList<String> a = new ArrayList<String>();
        String c=parent.getAbsolutePath();
        a.add(c);
        for (File f : files) {
            if (f.isDirectory()) {
                String b = f.getAbsolutePath();
                a.add(b);
            }
        }
        ExecutorService ex= Executors.newCachedThreadPool();
        Future<ArrayList<Integer>> s= ex.submit(new DirectoryList(a));
return a;
    }
}
