Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
1.2.3
-
None
Description
FileFilterUtil.filesInFolderMatchingStemRegex(String) currently calls String.matches(stemRegex) once for each file or directory in the folder. The is inefficient and noticeably so for folders with large numbers of files as it causes the same Pattern to be compiled once for each file or directory in the folder. The repeat compilation could be avoided by performing it once outside of the filtering callback:
Pattern pattern = Pattern.compile(stemRegex); return file.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return pattern.matcher(name).matches(); } });
Attachments
Issue Links
- links to