void (List<? super File> container, File from, String relativePath, final AntDomPattern pattern) { if (myDirsProcessed > MAX_DIRS_TO_PROCESS) { return; } final File[] children = from.listFiles(); if (children != null && children.length > 0) { if (myDirCheckEnabled) { if (!pattern.couldBeIncluded(relativePath)) { return; } } else { myDirCheckEnabled = true; } myDirsProcessed++; for (File child : children) { final String childPath = makePath(relativePath, child.getName()); if (pattern.acceptPath(childPath)) { container.add(child); } collectFiles(container, child, childPath, pattern); } } }