I have a list huge list of strings. The strings are either "ACCEPTED", "OK" or " NOT OK".
If list contains one ACCEPTED
the final value should be ACCEPTED
, irregardless of the other values. If there is no ACCEPTED
but there is an OK
, the final value should be OK
. If neither of them appear, the final value should be NOT OK
.
I can use String.contains()
method to check the values contains certain string, but I have a huge list. Therefore I am afraid it will cause the performance issue.
if(s.contains(("ACCEPTED"))) {
value= "ACCEPTED";
break;
} else if(s.contains(("OK"))) {
value= "OK";
break;
} else {
value= "NOT OK";
}
Will this method work for huge lists, or do I need to use something else?