Java Utililty Methods Collection Contain

List of utility methods to do Collection Contain

Description

The list of methods to do Collection Contain are organized into topic(s).

Method

booleancontainsIgnoreCase(Collection collection, String testString)
Utility method which does a case-insensitive check on the given Collection of Strings for the passed testString, returning true if the Collection contains the passed string
if (collection == null) {
    return false;
for (String s : collection) {
    if (s.equalsIgnoreCase(testString)) {
        return true;
return false;
booleancontainsIgnoreCase(Collection collection, String value)
Checks if the given collection of strings contains the provided string ignoring case.
if (value == null) {
    return false;
for (String string : collection) {
    if (string.equalsIgnoreCase(value)) {
        return true;
return false;
booleancontainsIgnoreCase(Collection l, String s)
Used to see if a Collection of strings contains a string, ignoring case.
Iterator<String> it = l.iterator();
while (it.hasNext()) {
    if (it.next().equalsIgnoreCase(s)) {
        return true;
return false;
booleancontainsIgnoreCase(String searchedWord, Collection words)
contains Ignore Case
for (String name : words)
    if (name.equalsIgnoreCase(searchedWord))
        return true;
return false;
booleancontainsIgnoreCase4Collections(Collection c, String s)
contains Ignore Case Collections
if (c == null || s == null) {
    return false;
for (String string : c) {
    if (string.equalsIgnoreCase(s)) {
        return true;
return false;
booleancontainsInstance(Collection collection, Object element)
contains Instance
if (collection != null) {
    Iterator i$ = collection.iterator();
    while (i$.hasNext()) {
        Object candidate = i$.next();
        if (candidate == element) {
            return true;
return false;
booleancontainsInstance(Collection collection, Object element)
Check whether the given Collection contains the given element instance.
if (collection != null) {
    for (Object candidate : collection) {
        if (candidate == element) {
            return true;
return false;
...
booleancontainsInstanceOf(Collection collection, Class c)
Returns true if the collections contains any object that is an instance of the specified class, and false otherwise.
Iterator iterator = collection.iterator();
while (iterator.hasNext()) {
    Object obj = iterator.next();
    if (obj != null && obj.getClass().equals(c)) {
        return true;
return false;
...
booleancontainsKey(Collection keys, String key)
Answers if normalized key is contained in the set of keys
Iterator ksit = keys.iterator();
while (ksit.hasNext()) {
    String key1 = (String) ksit.next();
    if (key1.replaceAll(" ", "").equalsIgnoreCase(key.replaceAll(" ", ""))) {
        return (true);
return (false);
...
booleancontainsNo(Collection baseList, Collection valueList)
Checks if the given basic list contains any element of the given value list.
for (T v : valueList) {
    if (baseList.contains(v)) {
        return false;
return true;