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

booleanarrayContainsEntry(T[] array, T entry)
array Contains Entry
if (entry == null || array == null) {
    return false;
for (T arrayEntry : array) {
    if (arrayEntry != null && arrayEntry.equals(entry)) {
        return true;
return false;
booleanarrayContainsIgnoreCase(String[] array, String searchKey)
array Contains Ignore Case
if (array == null)
    return false;
for (String item : array) {
    if ((item == null && searchKey == null) || (item != null && item.equalsIgnoreCase(searchKey)))
        return true;
return false;
booleanarrayContainsIgnoreCase(String[] array, String str)
Returns true if and only if the String array contains the given string, case insensitive.
if (array.length == 0) {
    return false;
for (int i = 0; i < array.length; i++) {
    if (array[i].equalsIgnoreCase(str))
        return true;
return false;
...
booleanarrayContainsInt(int[] array, int test)
array Contains Int
for (int i = 0; i < array.length; i++) {
    if (array[i] == test) {
        return true;
return false;
booleanarrayContainsLower(String[] lemmas, String string)
array Contains Lower
string = string.toLowerCase();
for (String lemma : lemmas) {
    if (lemma.toLowerCase().equals(string)) {
        return true;
return false;
booleanarrayContainsNumber(Number[] array, Number number)
Returns whether or not the given array contains the given number.
return Arrays.stream(array).filter(item -> item != null && item.equals(number)).count() > 0;
booleanarrayContainsOK(final byte[] b)
Checks for the combination looking from end to begining, in the whole array
for (int i = b.length - 1; i >= 3; i--) {
    if (b[i] == 13 && b[i - 1] == 75 && b[i - 2] == 79 && b[i - 3] == 10) {
        return true;
return false;
booleanarrayContainsOnlyIgnoreCase(String[] array, String... strs)
Returns true if and only if the String array contains only the given strings, case insensitive.
if (array.length == 0) {
    return false;
for (int i = 0; i < array.length; i++) {
    if (arrayContainsIgnoreCase(strs, array[i]))
        continue;
    else
        return false;
...
booleanarrayContainsOverlap(Object[] array1, Object[] array2)
array Contains Overlap
for (Object o : array1) {
    for (Object o1 : array2) {
        if (o.equals(o1)) {
            return true;
return false;
...
booleanarrayContainsPartKey(String[] array, String key)
Method to find if the given key is part of any of the array values

e.g.

for (String string : array) {
    if (key.indexOf(string) != -1) {
        return true;
return false;