use toLowerCase and endsWith
@@ -193,11 +193,12 @@ public class FileNamesComponent extends FlowPane {
sb.append("\n");
}
- filters.stream().flatMap(f -> f.getExtensions().stream())
- .forEach(extension -> patterns.add(extension.toLowerCase().replace("*", "")));
+ filters.stream().flatMap(f -> f.getExtensions().stream()).forEach(
+ extension -> patterns.add(extension.toLowerCase().replace("*", "").toLowerCase()));
for (File file : files) {
- if (patterns.stream().anyMatch(filter -> file.getAbsolutePath().contains(filter))) {
+ if (patterns.stream()
+ .anyMatch(filter -> file.getAbsolutePath().toLowerCase().endsWith(filter))) {
sb.append(file.getPath()).append("\n");
}
}
