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 16.06.2015.
 */
public class FileList implements Callable <ArrayList<Integer>> {


    public ArrayList<Integer> call (ArrayList<String> k) {
        for (int i = 0; i < k.size(); i++) {
            String m=k.get(i);
            File parent = new File(m);
            int number = 0;
            ArrayList<Integer> a = new ArrayList<Integer>();
            File[] files = parent.listFiles();
            for (File f : files) {
                if (f.isFile()) {
                    number++;
                } else if (f.isDirectory()) {
                    String b = f.getAbsolutePath();
                    File c = new File(b);
                    ExecutorService ex = Executors.newCachedThreadPool();
                    Future<ArrayList<String>> s = ex.submit(new DirectoryList(c));
                }
            }
            a.add(number);

        }
        return a;
    }
}
