Here you can find the source of stringExistInList(String value, List
public static boolean stringExistInList(String value, List<String> searchList)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static boolean stringExistInList(String value, List<String> searchList) { for (String search : searchList) { if (value != null && value.equals(search)) { return true; } else if (value == null && search == null) { return true; }/*from w w w . j av a 2 s .c o m*/ } return false; } /** Returns true if the Strings are equal, case sensitive, or both null */ public static boolean equals(String s1, String s2) { if (s1 == null && s2 == null) return true; return s1 != null && s2 != null && s1.equals(s2); } }