List<File> (boolean stopAfterFirstMatch, @Nullable FileFilter filter, @Nullable String pathEnvVarValue, String @NotNull ... fileBaseNames) { if (pathEnvVarValue == null) { return Collections.emptyList(); } List<File> result = new SmartList<>(); List<String> dirPaths = getPathDirs(pathEnvVarValue); for (String dirPath : dirPaths) { File dir = new File(dirPath); if (dir.isAbsolute() && dir.isDirectory()) { for (String fileBaseName : fileBaseNames) { File exeFile = new File(dir, fileBaseName); if (exeFile.isFile() && exeFile.canExecute()) { if (filter == null || filter.accept(exeFile)) { result.add(exeFile); if (stopAfterFirstMatch) { return result; } } } } } } return result; }