Java Utililty Methods List Contain

List of utility methods to do List Contain

Description

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

Method

booleancontains(List list1, List list2)
contains
return false;
booleancontains(List container, List list, Comparator comparator)
Returns true if container contains all elements from list .
Iterator<T> listIterator = list.iterator();
Iterator<T> containerIterator = container.iterator();
T listElement = listIterator.next();
T containerElement = containerIterator.next();
while (true) {
    int r = comparator.compare(containerElement, listElement);
    if (r == 0) {
        if (!listIterator.hasNext()) {
...
Stringcontains(String str, List list)
contains
for (String s : list) {
    if (str.indexOf(s) != -1) {
        return s;
return null;
booleancontains1(final String id, final List idList)
This method checks if the given string is present in the list of String (s).
if ((id != null) && (idList != null)) {
    for (final String idFromList : idList) {
        if (idFromList.equals(id)) {
            return true;
return false;
...
booleancontainsAFloatingPointNumber(List values)
contains A Floating Point Number
for (Number value : values) {
    if (isAFloatingPointNumber(value)) {
        return true;
return false;
booleancontainsAll(List list, T... items)
contains All
if (isEmpty(list))
    return false;
if (items == null || items.length < list.size())
    return false;
for (T item : items)
    if (!list.contains(item))
        return false;
return true;
...
booleancontainsAllIgnoreCase(List left, List right)
contains All Ignore Case
for (String rightString : right) {
    if (!containsIgnoreCase(left, rightString)) {
        return false;
return true;
booleancontainsAny(final String projectName, final List indicators)
contains Any
for (final String indicator : indicators) {
    if (projectName.toLowerCase().startsWith(indicator.toLowerCase())) {
        return true;
return false;
booleancontainsAny(List value, Object[] values)
contains Any
if (value != null && values != null) {
    for (Object v : values) {
        if (value.contains(v)) {
            return true;
return false;
...
booleancontainsAny(Set theList, Set toSearch)
Checks to see if any elements of one set are present in another.
if (toSearch.isEmpty())
    return false;
else {
    Iterator iter = theList.iterator();
    while (iter.hasNext()) {
        Object obj = iter.next();
        if (toSearch.contains(obj))
            return true;
...