Java Utililty Methods Array Contain

List of utility methods to do Array Contain

Description

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

Method

booleanArrayContains(String[][] arr, String s)
Array Contains
s = s.toLowerCase().trim();
for (int i = 0; i < arr.length; i++)
    for (int j = 0; j < arr[i].length; j++)
        if (arr[i][j].toLowerCase().trim().equals(s))
            return true;
return false;
booleanarrayContains(T haystack[], T needle)
Checks if the haystack array contains a specified element
for (T test : haystack) {
    if (needle.equals(test))
        return true;
return false;
booleanarrayContains(T search, T[] array, boolean def)
array Contains
if (array == null) {
    return def;
for (T t : array) {
    if (search.equals(t)) {
        return true;
return false;
booleanarrayContains(T[] arr, T item)
Determines if a array of any type contains the given item.
for (T t : arr) {
    if (t.equals(item)) {
        return true;
return false;
booleanarrayContains(T[] array, T value)
Checks if the given array contains the specified value.
for (int i = 0; i < array.length; i++) {
    if (array[i] == value) {
        return true;
return false;
ListarrayContains(T[] source, T[] target)
return target array contains source values.
List<T> res = new ArrayList<T>();
for (T t : target) {
    for (T s : source) {
        if (t.equals(s))
            res.add(s);
return res;
...
booleanarrayContains(T[] src, T target)
Linear-search implementation, uses CollectionHelper#search(Object[],Object) .
return search(src, target) != -1;
booleanarrayContains(T[] ts, T t)
array Contains
for (T t1 : ts) {
    if ((t1 == null || t == null) && t != t1)
        continue;
    if (t1 == t || t1.equals(t))
        return true;
return false;
booleanarrayContains1(String[] parent, String[] child)
test if all items in parent also appears in child
if (child.length == 0) {
    return true;
String[] parentCopy = Arrays.copyOf(parent, parent.length);
String[] childCopy = Arrays.copyOf(child, child.length);
Arrays.sort(parentCopy);
Arrays.sort(childCopy);
int i = 0, j = 0;
...
booleanarrayContainsElement(T[] array, T element)
array Contains Element
boolean containsElement = false;
for (int i = 0; (i < array.length) && !containsElement; i++) {
    T arrayElement = array[i];
    if (arrayElement != null && arrayElement.equals(element)) {
        containsElement = true;
return containsElement;
...