I applied following logics to find out whether some keyword is in given text. Is there any logics for better performance than this?
String targetText = "whether given text contains some keywords";
String [] keyArray = {"bts", "army", "billboard", "keyword"}; // keywords array is not so big
Log.w("Answer", "is .. " + inList(targetText, keyArray));
(In this example, result is true because target has 'keyword')
. . .
boolean inList(String text, String[] lists) {
for (String s : lists) {
if (text.contains(s)) return true;
}
return false;
}