Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- List<File> file_dir = Files.list(getPath()).map(file -> {
- try {
- File files = FileUtil.toFileRepresentation(file.toAbsolutePath());
- if (files.isRegularFile()) {
- return file;
- } else {
- Files.list(files.getPath()).filter(Files::isRegularFile).map(f -> {
- return new RegularFile(f.toAbsolutePath());
- });
- }
- } catch (IOException ex) {
- System.err.println(file.toAbsolutePath() + " is invalid: " + ex.getMessage());
- return;
- }
- }).collect(Collectors.toList());
- Iterator<File> res = file_dir.iterator();
- return res;
- } catch (IOException ex) {
- ex.printStackTrace();
- System.err.println(getPath() + " is invalid: " + ex.getMessage());
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement