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 aList, Object anObj)
Returns whether list contains given object (accepts null list).
return aList != null && aList.contains(anObj);
booleancontains(List list, Object obj)
Checks if the given list contains a specific object value by comparing the string version.
for (Object entry : list) {
    if (entry.toString().equals(obj.toString()))
        return true;
return false;
booleancontains(List lsttor, Object val)
contains
for (int i = 0; i < lsttor.size(); i++)
    if (lsttor.get(i).equals(val))
        return true;
return false;
booleancontains(List list, Object element, int begin, int end)
contains
return indexOf(list, element, begin, end) != -1;
booleancontains(List objects, Object object)
contains
boolean contains = objects.contains(object);
return contains;
booleancontains(List listOfArrays, A[] array)
Checks if the given list of arrays contains an array that is equal to array by the definition of Arrays.equal(..) (both arrays must have the same number of elements, and every pair of elements must be equal according to Object.equals).
for (A[] curArray : listOfArrays) {
    if (Arrays.equals(curArray, array))
        return true;
return false;
booleancontains(List list, int[] arr)
contains
for (int[] arr2 : list) {
    if (arr.length != arr2.length)
        continue;
    for (int i = 0; i < arr2.length; i++)
        if (arr2[i] != arr[i])
            continue;
    return true;
return false;
booleancontains(List list, List> listOfLists)
contains
for (List<String> cur : listOfLists) {
    if (isSame(list, cur)) {
        return true;
return false;
booleancontains(List list, String str, boolean bcaseSensitive)
contains
if (list == null || list.isEmpty() || isNullOrEmpty(str))
    return false;
if (bcaseSensitive) {
    return list.contains(str);
for (String s : list) {
    if (s.equalsIgnoreCase(str))
        return true;
...
booleancontains(List list, String string)
This method checks if the list contains the given string (case sensitive).
if (isNotEmpty(list)) {
    for (String item : list) {
        if ((item != null && string != null && item.compareTo(string) == 0)
                || (item == null && string == null)) {
            return true;
return false;