Here you can find the source of find2(File baseDir, FileFilter filter, List
private static void find2(File baseDir, FileFilter filter, List<File> files, boolean includeHiddenFiles)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileFilter; import java.util.List; public class Main { private static void find2(File baseDir, FileFilter filter, List<File> files, boolean includeHiddenFiles) { assert baseDir != null && filter != null && files != null; for (File f : baseDir.listFiles()) { if (f.equals(baseDir)) { continue; }/*from w w w.j av a 2 s . c om*/ // Hidden? if (!includeHiddenFiles && f.isHidden()) { continue; } assert includeHiddenFiles || !f.getName().startsWith(".") : f; // Add? if (filter.accept(f)) { if (f.exists()) { files.add(f); } else { // a broken symlink -- skip it } } // Recurse if (f.isDirectory()) { find2(f, filter, files, includeHiddenFiles); } } } }