Java Array Search isIn(String name, String[] array)

Here you can find the source of isIn(String name, String[] array)

Description

Inspects the array to see if it contains the passed string.

License

LGPL

Parameter

Parameter Description
name The name to search for
array The array to search

Return

true if the array contains the passed string.

Declaration

public static boolean isIn(String name, String[] array) 

Method Source Code

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

import java.util.Arrays;

public class Main {
    /**/*from ww w.  ja  v a2 s.c  om*/
     * Inspects the array to see if it contains the passed string.
     * @param name The name to search for
     * @param array The array to search
     * @return true if the array contains the passed string.
     */
    public static boolean isIn(String name, String[] array) {
        if (array == null || name == null)
            return false;
        return Arrays.binarySearch(array, name) >= 0;
    }
}

Related

  1. byteArraySearch(byte[] data, byte[] searchData)
  2. contains(byte[] array, byte toSearch)
  3. getFoundIdx(char to_find, char[] to_search, boolean do_orderAsc)
  4. indexOf(T[] array, T toSearch)
  5. isIn(char to_find, char[] to_search)
  6. isIn(String name, String[] array)
  7. isInArray(final T ch, final T[] a)
  8. isInArray(String needle, String[] haystack)
  9. memchr(boolean[] ary, int start, int len, boolean find)