Java List Contain containsIgnoreCase(List list, String s)

Here you can find the source of containsIgnoreCase(List list, String s)

Description

Returns true if the passed list contains the passed String s, ignoring case.

License

Apache License

Parameter

Parameter Description
list a parameter
s a parameter

Declaration

public static boolean containsIgnoreCase(List<String> list, String s) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    /**/* w w w.jav a  2s .  co  m*/
     * Returns true if 's' contains 'searchFor', ignoring case. 
     * @param s
     * @param searchFor
     * @return
     */
    public static boolean containsIgnoreCase(String s, String searchFor) {
        return s.toLowerCase().contains(searchFor.toLowerCase());
    }

    /**
     * Returns true if the passed list contains the passed String s, ignoring
     * case.
     * 
     * @param list
     * @param s
     * @return
     */
    public static boolean containsIgnoreCase(List<String> list, String s) {
        for (String string : list) {
            if (string.toLowerCase().equals(s.toLowerCase())) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. containsId(List aList, Object anObj)
  2. containsIgnoreCase(final String candidate, final List options)
  3. containsIgnoreCase(final String string, final List list)
  4. containsIgnoreCase(List list, String strIn)
  5. containsIgnoreCase(List list, String findMe)
  6. containsIgnoreCase(List list, String soughtFor)
  7. containsIgnoreCase(String str, String... list)
  8. containsInAnyOrder(final List test, final List control)
  9. containsIndex(int index, List objects)