List of utility methods to do Array Contain
boolean | arrayContainsEntry(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; |
boolean | arrayContainsIgnoreCase(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; |
boolean | arrayContainsIgnoreCase(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; ... |
boolean | arrayContainsInt(int[] array, int test) array Contains Int for (int i = 0; i < array.length; i++) { if (array[i] == test) { return true; return false; |
boolean | arrayContainsLower(String[] lemmas, String string) array Contains Lower string = string.toLowerCase(); for (String lemma : lemmas) { if (lemma.toLowerCase().equals(string)) { return true; return false; |
boolean | arrayContainsNumber(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;
|
boolean | arrayContainsOK(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; |
boolean | arrayContainsOnlyIgnoreCase(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; ... |
boolean | arrayContainsOverlap(Object[] array1, Object[] array2) array Contains Overlap for (Object o : array1) { for (Object o1 : array2) { if (o.equals(o1)) { return true; return false; ... |
boolean | arrayContainsPartKey(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; |