Java Collection Contain containsIgnoreCase(Collection l, String s)

Here you can find the source of containsIgnoreCase(Collection l, String s)

Description

Used to see if a Collection of strings contains a string, ignoring case.

License

BSD License

Parameter

Parameter Description
l - collection of strings.
s - string item to see if exists in the collection.

Return

true/false value.

Declaration

public static boolean containsIgnoreCase(Collection<String> l, String s) 

Method Source Code

//package com.java2s;
/**/*  w  w w .ja v  a 2  s.c  o  m*/
 * Copyright 5AM Solutions Inc, ESAC, ScenPro & SAIC
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/caintegrator/LICENSE.txt for details.
 */

import java.util.Collection;

import java.util.Iterator;

public class Main {
    /**
     * Used to see if a Collection of strings contains a string, ignoring case.
     * @param l - collection of strings.
     * @param s - string item to see if exists in the collection.
     * @return true/false value.
     */
    public static boolean containsIgnoreCase(Collection<String> l, String s) {
        Iterator<String> it = l.iterator();
        while (it.hasNext()) {
            if (it.next().equalsIgnoreCase(s)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. containsIgnoreCase(Collection c, String s)
  2. containsIgnoreCase(Collection c, String s)
  3. containsIgnoreCase(Collection c, String str)
  4. containsIgnoreCase(Collection collection, String testString)
  5. containsIgnoreCase(Collection collection, String value)
  6. containsIgnoreCase(String searchedWord, Collection words)
  7. containsIgnoreCase4Collections(Collection c, String s)
  8. containsInstance(Collection collection, Object element)
  9. containsInstance(Collection collection, Object element)