Example usage for org.apache.commons.io.comparator PathFileComparator PATH_INSENSITIVE_COMPARATOR

List of usage examples for org.apache.commons.io.comparator PathFileComparator PATH_INSENSITIVE_COMPARATOR

Introduction

In this page you can find the example usage for org.apache.commons.io.comparator PathFileComparator PATH_INSENSITIVE_COMPARATOR.

Prototype

Comparator PATH_INSENSITIVE_COMPARATOR

To view the source code for org.apache.commons.io.comparator PathFileComparator PATH_INSENSITIVE_COMPARATOR.

Click Source Link

Document

Case-insensitive path comparator instance (see IOCase#INSENSITIVE )

Usage

From source file:net.sourceforge.pmd.util.FileFinder.java

/**
 * Implements a tail recursive file scanner
 *///  ww  w.  j  av a  2 s .co  m
private void scanDirectory(File dir, List<File> list, boolean recurse) {
    File[] candidates = dir.listFiles(filter);
    if (candidates == null) {
        return;
    }

    Arrays.sort(candidates, PathFileComparator.PATH_INSENSITIVE_COMPARATOR);

    for (File tmp : candidates) {
        if (tmp.isDirectory()) {
            if (recurse) {
                scanDirectory(tmp, list, true);
            }
        } else {
            list.add(tmp);
        }
    }
}