code: public static void collectPaths(Path path,
                                    FileSystem fs,
                                    PathFilter filter,
                                    final List<Path> accumulator) throws IOException {
  
      walkPath(path, fs, filter, new PathVisitor() {
        @Override
        public void visit(FileStatus fileStatus) {
          accumulator.add(fileStatus.getPath());
        }
      });
    }
docs: Recursively walk a path, adding paths that are accepted by filter to accumulator
  
  @param path root path to begin walking, will be added to accumulator
  @param fs FileSystem for this path
  @param filter filter to determine which paths to accept
  @param accumulator all paths accepted will be added to accumulator
  @throws IOException