Java Array Contain arrayContainsEntry(T[] array, T entry)

Here you can find the source of arrayContainsEntry(T[] array, T entry)

Description

array Contains Entry

License

Open Source License

Declaration

private static <T> boolean arrayContainsEntry(T[] array, T entry) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008, 2010 VMware Inc./* www .j a va2s  .c  om*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   VMware Inc. - initial contribution
 *******************************************************************************/

public class Main {
    private static <T> boolean arrayContainsEntry(T[] array, T entry) {
        if (entry == null || array == null) {
            return false;
        }
        for (T arrayEntry : array) {
            if (arrayEntry != null && arrayEntry.equals(entry)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. arrayContains(T[] source, T[] target)
  2. arrayContains(T[] src, T target)
  3. arrayContains(T[] ts, T t)
  4. arrayContains1(String[] parent, String[] child)
  5. arrayContainsElement(T[] array, T element)
  6. arrayContainsIgnoreCase(String[] array, String searchKey)
  7. arrayContainsIgnoreCase(String[] array, String str)
  8. arrayContainsInt(int[] array, int test)
  9. arrayContainsLower(String[] lemmas, String string)