Java Array Contain arrayContains(T search, T[] array, boolean def)

Here you can find the source of arrayContains(T search, T[] array, boolean def)

Description

array Contains

License

Open Source License

Declaration

public static <T> boolean arrayContains(T search, T[] array, boolean def) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static <T> boolean arrayContains(T search, T[] array, boolean def) {
        if (array == null) {
            return def;
        }//from   w ww. j av a  2 s. co m

        for (T t : array) {
            if (search.equals(t)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. arrayContains(String[] array, String word)
  2. arrayContains(String[] parent, String[] child)
  3. arrayContains(String[] pArray, String pItem)
  4. ArrayContains(String[][] arr, String s)
  5. arrayContains(T haystack[], T needle)
  6. arrayContains(T[] arr, T item)
  7. arrayContains(T[] array, T value)
  8. arrayContains(T[] source, T[] target)
  9. arrayContains(T[] src, T target)