Added FilterKeywords class (zerrium package)
This commit is contained in:
parent
c0adbb0ab1
commit
110db39ff6
28
app/src/main/java/zerrium/FilterKeywords.java
Normal file
28
app/src/main/java/zerrium/FilterKeywords.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user