code: public Map<Path,List<LineMatches>> find(String search) throws IOException {
          count = 0;
          Pattern pattern = Pattern.compile(search);
          Map<Path,List<LineMatches>> fileMatches = new LinkedHashMap<>();
          Files.walkFileTree(root,
              EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() {
                  public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
                      for (PathMatcher matcher : matchers) {
                          if (matcher.matches(path)) {
                              List<LineMatches> lineMatches = search(path, pattern);
                              if (lineMatches != null)
                                  fileMatches.put(root.relativize(path), lineMatches);
                          }
                      }
                      return count == 0 || count < limit ? FileVisitResult.CONTINUE : FileVisitResult.TERMINATE;
                  }
              }
          );
  
          return fileMatches;
      }
docs: Find all line matches (mapped per file path).