apacheandroid/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java
/**
     * <p>
     * Applies an {@link IOFileFilter} to the provided {@link File} 
     * objects. The resulting array is a subset of the original file list that 
     * matches the provided filter.
     * </p>
     * 
     * <p>
     * The {@link Set} returned by this method is not guaranteed to be thread safe.
     * </p>
     * 
     * <pre>
     * Set&lt;File&gt; allFiles = ...
     * Set&lt;File&gt; javaFiles = FileFilterUtils.filterSet(allFiles,
     *     FileFilterUtils.suffixFileFilter(".java"));
     * </pre>
     * @param filter the filter to apply to the set of files.
     * @param files the array of files to apply the filter to.
     * 
     * @return a subset of <code>files</code> that is accepted by the 
     *         file filter.
     * @throws IllegalArgumentException if the filter is <code>null</code> 
     *         or <code>files</code> contains a <code>null</code> value. 
     * 
     * @since 2.0
     */

Applies an  IOFileFilter to the provided  File
objects. The resulting array is a subset of the original file list that
matches the provided filter.


The  Set returned by this method is not guaranteed to be thread safe.


Set<File> allFiles =
Set<File> javaFiles = FileFilterUtils.filterSet(allFiles,
FileFilterUtils.suffixFileFilter(".java"));

@param filter the filter to apply to the set of files.
@param files the array of files to apply the filter to.

@return a subset of files that is accepted by the
file filter.
@throws IllegalArgumentException if the filter is null
or files contains a null value.


Applies an IOFileFilter to the provided File objects . The resulting array is a subset of the original file list that matches the provided filter . The Set returned by this method is not guaranteed to be thread safe . Set<File > allFiles = Set<File > javaFiles = FileFilterUtils . filterSet ( allFiles FileFilterUtils . suffixFileFilter ( " . java " )) ; @param filter the filter to apply to the set of files . @param files the array of files to apply the filter to . @return a subset of files that is accepted by the file filter . @throws IllegalArgumentException if the filter is null or files contains a null value .
public static File[] filter(IOFileFilter filter, File... files) {
        if (filter == null) {
            throw new IllegalArgumentException("file filter is null");
        }
        if (files == null) {
            return new File[0];
        }
        List<File> acceptedFiles = new ArrayList<File>();
        for (File file : files) {
            if (file == null) {
                throw new IllegalArgumentException("file array contains null");
            }
            if (filter.accept(file)) {
                acceptedFiles.add(file);
            }
        }
        return acceptedFiles.toArray(new File[acceptedFiles.size()]);
    }
public static File [ ] filter ( IOFileFilter filter , File ... files ) { if ( filter == null ) { throw new IllegalArgumentException ( "file filter is null" ) ; } if ( files == null ) { return new File [ 0 ] ; } List < File > acceptedFiles = new ArrayList < File > ( ) ; for ( File file : files ) { if ( file == null ) { throw new IllegalArgumentException ( "file array contains null" ) ; } if ( filter . accept ( file ) ) { acceptedFiles . add ( file ) ; } } return acceptedFiles . toArray ( new File [ acceptedFiles . size ( ) ] ) ; }
<p>
 Applies an {@link IOFileFilter} to the provided {@link File}
 objects.
<p > Applies an { @link IOFileFilter } to the provided { @link File } objects .