Added FilterKeywords class (zerrium package)

This commit is contained in:
zerrium 2021-03-18 11:32:50 +07:00
parent c0adbb0ab1
commit 110db39ff6

View File

@ -0,0 +1,28 @@
package zerrium;
import java.util.ArrayList;
import java.util.Arrays;
public class FilterKeywords {
private static final ArrayList<String> FILTER_KEYWORDS = new ArrayList<>();
public static boolean append(String keyword){
if(keyword == null) return false;
FILTER_KEYWORDS.add(keyword);
return true;
}
public static boolean insert(String[] keywords){
if(keywords == null) return false;
FILTER_KEYWORDS.addAll(Arrays.asList(keywords));
return true;
}
public static boolean filter(String word){
if(word == null) return false;
for(String s:FILTER_KEYWORDS){
if(word.contains(s)) return true;
}
return false;
}
}