content: package Week10.VisitorPattern;
  
  import java.io.IOException;
  import java.nio.file.FileVisitResult;
  import java.nio.file.FileVisitor;
  import java.nio.file.Path;
  import java.nio.file.attribute.BasicFileAttributes;
  
  public class MyFileVisitor implements FileVisitor<Path> {
  
      @Override
      public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
          System.out.println(dir);
          return FileVisitResult.CONTINUE;
      }
  
      @Override
      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
          System.out.println(file);
          if(file.toString().endsWith(".java"))
              return  FileVisitResult.TERMINATE;
          return  FileVisitResult.CONTINUE;
      }
  
      @Override
      public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
          return  FileVisitResult.CONTINUE;
      }
  
      @Override
      public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
          return  FileVisitResult.CONTINUE;
      }
  }
  