What is the difference between Files.list and Files.walkFileTree and Files.walk with maxdepth = 1?
<p>If I want to do something with files only on the first level of the directory,
is there a difference between using <code>Files.list(...)</code> or <code>Files.walkFileTree(...)</code> or <code>Files.walk(...)</code>?</p>

<pre><code>Files.walkFileTree(directory, Collections.emptySet(), 1, new SimpleFileVisitor&lt;Path&gt;() {
    @Override
    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
        doSomething(file);
        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult visitFileFailed(Path file, IOException exc) {
        // log exc
        return FileVisitResult.CONTINUE;
    }
});
</code></pre>

<p>versus</p>

<pre><code>Files.list(directory)
    .forEach(path -&gt; {
        try {
            doSomething(path);
        } catch (IOException exc) {
            // log exc
        }
    });
</code></pre>

<p>versus</p>

<pre><code>Files.walk(directory, 1)
    .forEach(path -&gt; {
        try {
            doSomething(path);
        } catch (IOException exc) {
            // log exc
        }
});
</code></pre>