JkPathTree implements Closeable { public Stream<Path> stream(FileVisitOption ...options) { if(!exists()) { return new LinkedList<Path>().stream(); } final JkPathMatcher matcher = JkPathMatcher.of(this.matcher); return JkUtilsPath.walk(getRoot(), options) .filter(path -> matcher.matches(getRoot().relativize(path))) .onClose(() -> rootHolder.closeIfNeeded()); } private  JkPathTree(RootHolder rootHolder, JkPathMatcher matcher); static JkPathTree of(Path rootDir); static JkPathTree ofZip(Path zipFile); Path getRoot(); Path getRootDirOrZipFile(); JkPathMatcher getMatcher(); boolean isDefineMatcher(); boolean exists(); JkPathTree createIfNotExist(); Stream<Path> stream(FileVisitOption ...options); List<Path> getRelativeFiles(); List<Path> getFiles(); JkPathTree goTo(String relativePath); JkPathTree resolvedTo(Path newRoot); Path get(String relativePath); JkPathTree importDir(Path dirToCopy, CopyOption... copyOptions); JkPathTree importTree(JkPathTree tree, CopyOption... copyOptions); JkPathTree importFiles(Iterable<Path> files, StandardCopyOption ... copyOptions); JkPathTree importFile(Path src, String targetName, StandardCopyOption ... copyOptions); JkPathTree deleteContent(); JkPathTree deleteRoot(); JkPathTree zipTo(Path destination); int copyTo(Path destinationDir, CopyOption ... copyOptions); void copyFile(String sourcePath, Path destinationDir, CopyOption ... copyOptions); JkPathTree andMatcher(PathMatcher pathMatcher); JkPathTree withMatcher(JkPathMatcher pathMatcher); JkPathTree andMatching(boolean positive, String... globPatterns); JkPathTree andMatching(String... globPatterns); JkPathTree andMatching(boolean positive, Iterable<String> globPatterns); int count(int max, boolean includeDirectories); JkPathTree resolve(Path path); JkPathTreeSet toSet(); @Override String toString(); @Override void close();  }
@Test public void testStream() throws Exception { Path sampleDir = sampleDir(); assertTrue(JkPathTree.of(sampleDir).stream().anyMatch(path -> path.equals(sampleDir))); }