Java 8 Path Stream and FileSystemException (Too many open files)
问题 geniuses! I'm practicing Java 8. So if I do something like this: Files.walk(Paths.get(corpusPathStr)) .filter(path -> path.toFile().isFile()) .forEach(path -> { try { Files.lines(path) .forEach(...); } catch (IOException e) { e.printStackTrace(); } }); I got FileSystemException error. If I open a file under forEach, may too many files be opened? Or are there other reasons causing FileSystemException (Too many open files)? Thanks for your help in advance! 回答1: Use try(Stream<Path> stream =