Java Array Contain arrayContains(T[] ts, T t)

Here you can find the source of arrayContains(T[] ts, T t)

Description

array Contains

License

Apache License

Declaration

public static <T> boolean arrayContains(T[] ts, T t) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static <T> boolean arrayContains(T[] ts, T t) {
        for (T t1 : ts) {
            if ((t1 == null || t == null) && t != t1)
                continue;
            if (t1 == t || t1.equals(t))
                return true;
        }/* ww  w.  j  a v a  2s  . c  om*/
        return false;
    }
}

Related

  1. arrayContains(T search, T[] array, boolean def)
  2. arrayContains(T[] arr, T item)
  3. arrayContains(T[] array, T value)
  4. arrayContains(T[] source, T[] target)
  5. arrayContains(T[] src, T target)
  6. arrayContains1(String[] parent, String[] child)
  7. arrayContainsElement(T[] array, T element)
  8. arrayContainsEntry(T[] array, T entry)
  9. arrayContainsIgnoreCase(String[] array, String searchKey)