Advertisement
Alice_Kim

build tree 12h1

Jan 20th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. try {
  2. List<File> file_dir = Files.list(getPath()).map(file -> {
  3. try {
  4. File files = FileUtil.toFileRepresentation(file.toAbsolutePath());
  5. if (files.isRegularFile()) {
  6. return file;
  7. } else {
  8. Files.list(files.getPath()).filter(Files::isRegularFile).map(f -> {
  9. return new RegularFile(f.toAbsolutePath());
  10. });
  11. }
  12. } catch (IOException ex) {
  13. System.err.println(file.toAbsolutePath() + " is invalid: " + ex.getMessage());
  14. return;
  15. }
  16. }).collect(Collectors.toList());
  17. Iterator<File> res = file_dir.iterator();
  18. return res;
  19. } catch (IOException ex) {
  20. ex.printStackTrace();
  21. System.err.println(getPath() + " is invalid: " + ex.getMessage());
  22. return null;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement