Java - contains check all items in an arraylist meet a condition -


myarraylist = {"method , apparatus","system , method same","drive-modulation method"," method orthogonal"} 

how can check if items (myarraylist) contains word "method" (irrespective of case)

boolean method return true if items contain word, else false

iterate , use contains. remove or conditions if want case specific.

   public static boolean islistcontainmethod(list<string> arraylist) {     (string str : arraylist) {         if (!str.tolowercase().contains("method")) {             return false;         }     }     return true; } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -