public static Collection<File> collectFiles(final Collection<File> in,final FileFilter filter){
  if (in == null)   throw new IllegalArgumentException();
  if (filter == null)   throw new IllegalArgumentException();
  final Collection<File> out=new LinkedList<File>();
  for (  File file : in) {
    if (file.isDirectory()) {
      if (log.isInfoEnabled())       log.info("Reading directory: " + file);
      final File[] files=file.listFiles(filter);
      out.addAll(collectFiles(Arrays.asList(files),filter));
    }
 else {
      if (filter.accept(file)) {
        out.add(file);
      }
    }
  }
  return out;
}

public static Collection < File > collectFiles ( final Collection < File > in , final FileFilter filter ) { if ( in == null ) throw new IllegalArgumentException ( ) ; if ( filter == null ) throw new IllegalArgumentException ( ) ; final Collection < File > out = new LinkedList < File > ( ) ; for ( File file : in ) { if ( file . isDirectory ( ) ) { if ( log . isInfoEnabled ( ) ) log . info ( "Reading directory: " + file ) ; final File [ ] files = file . listFiles ( filter ) ; out . addAll ( collectFiles ( Arrays . asList ( files ) , filter ) ) ; } else { if ( filter . accept ( file ) ) { out . add ( file ) ; } } } return out ; }
return the specified files , substituting recursively spanned files when a given file is a directory .
