title: FilenameFilter to show list files with certain extension and directories
body: <p>I am using FilenameFilter class to list all files with certain extension in the directory. But I would also like to list all the directories in that directory.
  I searched through the internet and found out only how to use FilenameFilter for multiple extensions. But how can I do that also with directories?</p>
  
  <p>Here is code that I use to list all .txt files:</p>
  
  <pre><code>File[] listOfFiles = folder.listFiles(new FilenameFilter() {
          public boolean accept(File dir, String name) {
              return name.toLowerCase().endsWith(".txt");
          }
      }); 
  </code></pre>
  
  <p>Is there even a way to do it via filter or do I have to do it in some other way?</p>