### Question:
PropertiesUtils { public static <T> List<T> filterPropertiesByLocale(List<T> entries, ExtractHandler<T> handler) { List<String> localeNames = new LinkedList<>(); for (Locale locale : LocaleUtils.availableLocaleSet()) { localeNames.add(locale.getLanguage() + "_" + locale.getCountry()); } List<T> nonLocaleFiles = new LinkedList<>(); for (T entry : entries) { long countOfLocaled = localeNames.stream().filter( locale -> handler.getFileName(entry).endsWith(locale + ".properties")) .count(); if (countOfLocaled <= 0) { nonLocaleFiles.add(entry); } } Locale curLocale = Locale.getDefault(); List<T> ret = new LinkedList<>(); for (T nonLocaleEntry : nonLocaleFiles) { String nonLocaleFileName = StringUtils.substringBeforeLast(handler.getFileName(nonLocaleEntry), ".properties"); handler.onPureFileName(nonLocaleFileName); List<T> collect = entries.stream().filter( file -> handler.getFileName(file).equals( String.format("%s_%s.properties", nonLocaleFileName, curLocale))) .collect(Collectors.toList()); if (!collect.isEmpty()) { ret.addAll(collect); } else { ret.add(nonLocaleEntry); } } return ret; }  static List<T> filterPropertiesByLocale(List<T> entries, ExtractHandler<T> handler);  }### Answer:
@Test void filterPropertiesByLocale() { File[] resourceFiles = ClasspathResourceUtils.getResourceFiles("", ".properties"); if (resourceFiles == null || resourceFiles.length == 0) { throw new RuntimeException(String.format("Loading resources aborted, unable to find any resource files")); } List<File> resourceFileList = Arrays.asList(resourceFiles); System.out.println("resourceFileList: " + resourceFileList.size()); List<File> filesToLoad = PropertiesUtils.filterPropertiesByLocale(resourceFileList, new PropertiesUtils.ExtractHandler<File>() { @Override public String getFileName(File file) { return file.getName(); } @Override public void onPureFileName(String pureName) { System.out.println("# " + pureName); try { Class<?> resClass = Class.forName(pureName); System.out.println(resClass); } catch (ClassNotFoundException e) { System.out.println("Not a information resource file: " + e.getLocalizedMessage()); } } }); for (File resourceFile : filesToLoad) { System.out.println("Load: " + resourceFile); } }