Java String from List stringExistInList(String value, List searchList)

Here you can find the source of stringExistInList(String value, List searchList)

Description

string Exist In List

License

Open Source License

Declaration

public static boolean stringExistInList(String value, List<String> searchList) 

Method Source Code

//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);
    }
}

Related

  1. stringFromLines(List lines)
  2. stringFromList(List list)
  3. stringfyList(List ls)
  4. stringify(List entries)