Java Utililty Methods Recursive List

List of utility methods to do Recursive List

Description

The list of methods to do Recursive List are organized into topic(s).

Method

File[]recursiveList(File dir, FilenameFilter filter)
recursive List
Vector v = new Vector();
addRecursiveList(dir, filter, v);
File[] files = new File[v.size()];
v.copyInto(files);
return files;
ListrecursiveListFile(File folder)
recursive List File
return recursiveListFile(folder, "", f -> true);
ListrecursiveListFiles(File baseDir, final FileFilter filter)
recursive List Files
FileFilter dirFilter = new FileFilter() {
    public boolean accept(File pathname) {
        return pathname.isDirectory() || filter.accept(pathname);
};
File[] fileArray = baseDir.listFiles(dirFilter);
List<File> files = new ArrayList<File>(fileArray.length);
for (int i = 0; i < fileArray.length; i++) {
...
File[]recursiveListFiles(File dir, FileFilter filter)
recursive List Files
if (!dir.isDirectory())
    throw new IllegalArgumentException(dir + " is not a directory");
List<File> fileList = new ArrayList<File>();
recursiveListFilesHelper(dir, filter, fileList);
return fileList.toArray(new File[fileList.size()]);
voidrecursiveListFiles(File file, List files)
recursive List Files
for (File f : file.listFiles()) {
    if (f.isDirectory()) {
        recursiveListFiles(f, files);
    files.add(f);
ListrecursiveListFiles(String path)
recursive List Files
List<File> result = new ArrayList<File>(Arrays.asList(new File(path).listFiles()));
for (File f : new File(path).listFiles())
    if (f.isDirectory())
        result.addAll(recursiveListFiles(f.getAbsolutePath()));
return result;
voidrecursiveListFilesHelper(File dir, FileFilter filter, List fileList)
recursive List Files Helper
for (File f : dir.listFiles()) {
    if (f.isDirectory()) {
        recursiveListFilesHelper(f, filter, fileList);
    } else {
        if (filter.accept(f))
            fileList.add(f);
voidrecursiveListint(List list, File file, FilenameFilter filter)
If the parameter file is a file then it is added to the list of files.
if (file.isFile()) {
    list.add(file);
} else {
    File[] children = null;
    if (filter != null) {
        children = file.listFiles(filter);
    } else {
        children = file.listFiles();
...
SortedSetrecursiveListPartialPaths(File parent, boolean includeDirs)
Recursively lists a directory, returning the partial paths of the child files.
assert parent != null;
TreeSet<String> toReturn = new TreeSet<String>();
int start = parent.getAbsolutePath().length() + 1;
List<File> q = new LinkedList<File>();
q.add(parent);
while (!q.isEmpty()) {
    File f = q.remove(0);
    if (f.isDirectory()) {
...