title: How to use Java 8 `Files.find` method?
body: <p>I am trying to write an app to use <code>Files.find</code> method in it.</p>
  
  <p>Below program works perfectly : </p>
  
  <pre><code>package ehsan;
  
  /* I have removed imports for code brevity */
  
  public class Main {
      public static void main(String[] args) throws IOException {
          Path p = Paths.get("/home/ehsan");
          final int maxDepth = 10;
          Stream&lt;Path&gt; matches = Files.find(p,maxDepth,(path, basicFileAttributes) -&gt; String.valueOf(path).endsWith(".txt"));
          matches.map(path -&gt; path.getFileName()).forEach(System.out::println);
      }
  }
  </code></pre>
  
  <p>This works fine and gives me a list of files ending with <code>.txt</code> ( aka text files ) :</p>
  
  <pre><code>hello.txt
  ...
  </code></pre>
  
  <p>But below program does not show anything : </p>
  
  <pre><code>package ehsan;
  
  public class Main {
      public static void main(String[] args) throws IOException {
          Path p = Paths.get("/home/ehsan");
          final int maxDepth = 10;
          Stream&lt;Path&gt; matches = Files.find(p,maxDepth,(path, basicFileAttributes) -&gt; path.getFileName().equals("workspace"));
          matches.map(path -&gt; path.getFileName()).forEach(System.out::println);
      }
  }
  </code></pre>
  
  <p>But it does not show anything :( </p>
  
  <p>Here is my home folder hiearchy (<code>ls</code> result) : </p>
  
  <pre><code>blog          Projects
  Desktop       Public
  Documents     Templates
  Downloads     The.Purge.Election.Year.2016.HC.1080p.HDrip.ShAaNiG.mkv
  IdeaProjects          The.Purge.Election.Year.2016.HC.1080p.HDrip.ShAaNiG.mkv.aria2
  Music         Videos
  Pictures      workspace
  </code></pre>
  
  <p>So whats going wrong with <code>path.getFileName().equals("workspace")</code>?</p>