Java: one-liner to list Dirs in a directory?

Posted by Heoa on Stack Overflow See other posts from Stack Overflow or by Heoa
Published on 2010-04-02T19:11:36Z Indexed on 2010/04/02 19:13 UTC
Read the original article Hit count: 176

Filed under:
|
|

One-Liner to list TXT-files.

import java.io.File;
import java.io.FilenameFilter;
...
files = dir.listFiles(new FilenameFilter() {
           public boolean accept(File dir, String name) {
                return name.toLowerCase().endsWith(".txt");
                }
           }
        );

Source.

Is there an one-liner to list dirs in a dir?

© Stack Overflow or respective owner

Related posts about java

Related posts about beginner