daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.      * @param parent - каталог внутри которго находятся файлы и папки.
  3.      * @return
  4.      */
  5.     private static Iterable<File> getFileAsList(String parent) {
  6.         ArrayList<File> result = new ArrayList<>();
  7.         Deque<File> filesList = new ArrayDeque<>();
  8.         filesList.offer(new File(parent));
  9.         File temp;
  10.         while (!filesList.isEmpty()) {
  11.             temp = filesList.pollFirst();
  12.             if (temp.isDirectory()) {
  13.                 filesList.addAll(Arrays.asList(temp.listFiles()));
  14.             } else {
  15.                 System.out.println(temp.toString());
  16.                 result.add(temp);
  17.             }
  18.         }
  19.         return result;
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top