Java examples for java.util:List Contain
is String exist in list
//package com.java2s; import java.util.List; public class Main { public static void main(String[] argv) throws Exception { List array = java.util.Arrays.asList("asdf", "java2s.com"); String str = "java2s.com"; System.out.println(isExistString(array, str)); }//from ww w. ja v a 2s .com public static boolean isExistString(List<String> array, String str) { boolean r = false; for (String obj : array) { if (obj.equalsIgnoreCase(str)) { r = true; break; } } return r; } }