package org.lodder.subtools.sublibrary.util;

import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.TreeSet;

public class FilenameContainsFilter implements FilenameFilter {
    private final TreeSet<String> contains = new TreeSet<String>();

    public FilenameContainsFilter(String ext) {
        contains.add("." + ext.toLowerCase().trim());
    }

    public FilenameContainsFilter(String[] extensions) {
        for (String s : Arrays.asList(extensions)) {
            contains.add("." + s.toLowerCase().trim());
        }
        contains.remove("");
    }
    
    @Override
    public boolean accept(File dir, String name) {
        for (String contain : contains) {
            if (name.contains(contain)) {
                return true;
            }
        }
        return false;
    }
}

@@ -317,19 +317,17 @@
 (String 
-ext
+s
 ) %7B%0A    
@@ -347,31 +347,9 @@
 add(
-%22.%22 + ext.toLowerCase()
+s
 .tri
@@ -404,26 +404,22 @@
 tring%5B%5D 
-extensions
+sarray
 ) %7B%0A    
@@ -456,18 +456,14 @@
 ist(
-extensions
+sarray
 )) %7B
@@ -492,29 +492,9 @@
 add(
-%22.%22 + s.toLowerCase()
+s
 .tri

Fix bug in code