Searches for files with the given extensions and adds them to a Vector.

@param start
The path to the file.
@param extensions
The extensions to find.
@return Returns a Vector all founded files.
167085
public static List<File> findFiles(final String start, final String[] extensions)
	{
		final List<File> files = new ArrayList<>();
		final Stack<File> dirs = new Stack<>();
		final File startdir = new File(start);
		if (startdir.isDirectory())
		{
			dirs.push(new File(start));
		}
		while (dirs.size() > 0)
		{
			final File dirFiles = dirs.pop();
			final String s[] = dirFiles.list();
			if (s != null)
			{
				for (final String element : s)
				{
					final File file = new File(
						dirFiles.getAbsolutePath() + File.separator + element);
					if (file.isDirectory())
					{
						dirs.push(file);
					}
					else if (match(element, extensions))
					{
						files.add(file);
					}
				}
			}
		}
		return files;
	}
761918
private List<File> scanFileSets() {
        final List<File> list = new ArrayList<File>();

        for (int i = 0; i < fileSets.size(); i++) {
            FileSet fs = fileSets.get(i);
            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
            ds.scan();

            String[] names = ds.getIncludedFiles();
            for (String element : names) {
                list.add(new File(ds.getBasedir(), element));
            }
        }

        return list;
    }
1067608
public static Iterable<File> findFiles(final Collection<URL> inUrls, final Predicate<File> filePredicate) {
        Iterable<File> result = new ArrayList<File>();

        for (final URL url : inUrls) {
            try {
                result = Iterables.concat(result,
                        Iterables.filter(new Iterable<File>() {
                            public Iterator<File> iterator() {
                                return fromURL(url).getFiles().iterator();
                            }
                        }, filePredicate));
            } catch (Throwable e) {
                if (Reflections.log != null) {
                    Reflections.log.error("could not findFiles for url. continuing. [" + url + "]", e);
                }
            }
        }

        return result;
    }
140417
public ClassFinder add(Collection<File> files) {
    for (File file : files)
      add(file);

    return this;
  }

  /**
   * Clear the finder's notion of where to search.
   */
  public void clear() {
    placesToSearch.clear();
  }

  public ClassFinder setErrorIfResultEmpty(boolean errorIfResultEmpty) {
    this.errorIfResultEmpty = errorIfResultEmpty;
    return this;
  }

  /**
   * Find all classes in the search areas, implicitly accepting all of
   * them.
   *
   * @return Collection of found classes
   */
  public Collection<ClassInfo> findClasses() {
    return findClasses(null);
  }

  /**
   * Search all classes in the search areas, keeping only those that
   * pass the specified filter.
   *
   * @param filter  the filter, or null for no filter
   * @return Collection of found classes
   */
  public Collection<ClassInfo> findClasses(ClassFilter filter) {
    Map<String,ClassInfo> foundClasses = new ParallelClassLoader().loadClassesFrom(placesToSearch.values());
    log.info("Loaded " + foundClasses.size() + " classes.");

    Collection<ClassInfo> filteredClasses = filterClasses(filter, foundClasses);

    if (filteredClasses.size() == 0 && errorIfResultEmpty) {
      log.warn("Found no classes, throwing exception");
      throw new ClassFinderException("Didn't find any classes");
    } else {
      log.info("Returning " + filteredClasses.size() + " total classes");
    }
    foundClasses.clear();
    return filteredClasses;
  }

  private Collection<ClassInfo> filterClasses(ClassFilter filter, Map<String, ClassInfo> foundClasses) {
    Collection<ClassInfo> classes = new ArrayList<>();
    for (ClassInfo classInfo : foundClasses.values()) {
      String className = classInfo.getClassName();
      String locationName = classInfo.getClassLocation().getPath();
      log.trace("Looking at " + locationName + " (" + className + ")");
      if ((filter == null) || (filter.accept(classInfo, new ClassHierarchyResolver(foundClasses)))) {
        log.trace("Filter accepted " + className);
        classes.add(classInfo);
      } else {
        log.trace("Filter rejected " + className);
      }
    }
    return classes;
  }
}
347204
private List<String> existingRootFiles() {
        List<String> filesFound = new ArrayList<>();
        for (String path : SU_PATHS) {
            if (new File(path).exists()) {
                filesFound.add(path);
            }
        }
        return filesFound;
    }
151183
public static Iterable<File> findFiles(final Collection<URL> inUrls, final String packagePrefix, final Predicate<String> nameFilter) {
        Predicate<File> fileNamePredicate = new Predicate<File>() {
            public boolean apply(File file) {
                String path = file.getRelativePath();
                if (path.startsWith(packagePrefix)) {
                    String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length());
                    return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1));
                } else {
                    return false;
                }
            }
        };

        return findFiles(inUrls, fileNamePredicate);
    }
1349895
private PathFilter getFileFilter() {
    final String extension = (this.expectedExtension.startsWith(".")) ?
        this.expectedExtension :
        "." + this.expectedExtension;

    return new PathFilter() {
      @Override
      public boolean accept(Path path) {
        return path.getName().endsWith(extension) &&
            !(schemaInSourceDir && path.getName().equals(schemaFile)) ;
      }
    };
  }
357717
public static File [] getFilesWithPrefix(File dir, final String prefix) {
        FileFilter prefixFilter = new FileFilter() {
                public boolean accept(File pathname)
                {
                    return pathname.getName().toLowerCase().
                        startsWith(prefix.toLowerCase());
                }
            };
        return dir.listFiles(prefixFilter);
    }
1269566
public List<T> findAll(String path, @Nullable S conf, AlluxioConfiguration alluxioConf) {
    Preconditions.checkArgument(path != null, "path may not be null");

    List<T> factories = new ArrayList<>(mFactories);
    String libDir = PathUtils.concatPath(alluxioConf.get(PropertyKey.HOME), "lib");
    String extensionDir = alluxioConf.get(PropertyKey.EXTENSIONS_DIR);
    scanLibs(factories, libDir);
    scanExtensions(factories, extensionDir);

    List<T> eligibleFactories = new ArrayList<>();
    for (T factory : factories) {
      if (factory.supportsPath(path, conf)) {
        LOG.debug("Factory implementation {} is eligible for path {}", factory, path);
        eligibleFactories.add(factory);
      }
    }

    if (eligibleFactories.isEmpty()) {
      LOG.warn("No factory implementation supports the path {}", path);
    }
    return eligibleFactories;
  }
1340052
public java.util.List<ExtensionField> getExtensionFields() {
        if (extensionFields == null) {
            extensionFields = new com.amazonaws.internal.SdkInternalList<ExtensionField>();
        }
        return extensionFields;
    }
864095
def search_files(directories, extensions)
      extensions.each_with_object([]) do |ext, obj|
        directories.each do |dir|
          obj << FileList["#{dir}/*#{ext}"]
        end
      end.flatten.compact
    end
565717
public static File[] listExtensions(String extensionDir) {
    File[] extensions = new File(extensionDir)
        .listFiles(file -> file.getPath().toLowerCase().endsWith(Constants.EXTENSION_JAR));
    if (extensions == null) {
      // Directory does not exist
      return EMPTY_EXTENSIONS_LIST;
    }
    return extensions;
  }
633300
public static List<File> findFilesWithFilter(final File dir, final String... extension)
	{
		final List<File> foundedFileList = new ArrayList<>();
		final File[] children = dir.listFiles(new MultiplyExtensionsFileFilter(true, extension));
		for (final File element : children)
		{
			// if the entry is a directory
			if (element.isDirectory())
			{ // then
				// find recursively in the directory and put it in a List.
				// Put the founded files in the main List.
				foundedFileList.addAll(findFilesWithFilter(element, extension));
			}
			else
			{
				foundedFileList.add(element.getAbsoluteFile());
			}
		}
		return foundedFileList;
	}
186088
def files_with_exts(root='.', suffix=''):
    
    return (os.path.join(rootdir, filename)
            for rootdir, dirnames, filenames in os.walk(root)
            for filename in filenames
            if filename.endswith(suffix))
189583
public static List<File> listFileWithExtension(final File rootDir, final String extension) {
		return Files.fileTreeTraverser().preOrderTraversal(rootDir).filter(new FileExtensionFilter(extension)).toList();
	}
444104
public static FacesServletMapping createExtensionMapping(
        String extension)
    {
        FacesServletMapping mapping = new FacesServletMapping();
        mapping.setExtension(extension);
        return mapping;
    }
139695
public synchronized Vector getExtentClasses()
    {
        if (extentClassNames.size() != extentClasses.size())
        {
            extentClasses.clear();
            for (Iterator iter = extentClassNames.iterator(); iter.hasNext();)
            {
                String classname = (String) iter.next();
                Class extentClass;
                try
                {
                    extentClass = ClassHelper.getClass(classname);
                }
                catch (ClassNotFoundException e)
                {
                    throw new MetadataException(
                        "Unable to load class ["
                            + classname
                            + "]. Make sure it is available on the classpath.",
                        e);
                }
                extentClasses.add(extentClass);
            }
        }
        return extentClasses;
    }