Java Array Contain arrayContains(int[] array, int value)

Here you can find the source of arrayContains(int[] array, int value)

Description

array Contains

License

Open Source License

Declaration

public static boolean arrayContains(int[] array, int value) 

Method Source Code

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

public class Main {
    public static boolean arrayContains(int[] array, int value) {
        for (int i : array) {
            if (i == value) {
                return true;
            }/*from ww  w  .ja  v  a 2 s .  co m*/
        }
        return false;
    }

    public static boolean arrayContains(String[] array, String value) {
        for (String i : array) {
            if (i.equals(value)) {
                return true;
            }
        }
        return false;
    }

    public static boolean arrayContains(Object[] array, Object value) {
        for (Object i : array) {
            if (i != null && i.equals(value)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. arrayContains(final Object[] a, final Object v)
  2. arrayContains(final String[] array, String needle)
  3. arrayContains(final T[] array, final T v)
  4. arrayContains(int[] arr, int e)
  5. arrayContains(int[] arr, int ii)
  6. arrayContains(int[] array, int value)
  7. arrayContains(Object obj, Object[] array)
  8. arrayContains(Object[] a, Object ob)
  9. arrayContains(Object[] array, Object el)