title: ? How can I list all files in directory or drive without using stream and sort it by creation date using just nio api in java
body: <pre class="lang-java prettyprint-override"><code>import java.io.IOException;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  import java.util.stream.Stream;
  
  public class Explorateur {
      public void Fichiers(String chemin) throws IOException {
          Path disque=Paths.get(chemin);
          try (Stream&lt;Path&gt; paths=Files.walk(disque, Integer.MAX_VALUE)) {
              paths.filter(Files::isRegularFile)
                   .forEach(System.out::println);
          } catch(IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  <p>How can I do it without using Stream and sort it by creation date using just NIO ?</p>
  <p>At first I need to check if a specific file is there. The second function is to sort all files by creation date.</p>
  <p>I think that I should return a collection of files and creation date then sort it.</p>