Java Array Index Of indexOf(final String[] p_elements, final String p_key)

Here you can find the source of indexOf(final String[] p_elements, final String p_key)

Description

index Of

License

Open Source License

Declaration

public static int indexOf(final String[] p_elements, final String p_key) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Lab-STICC Universite de Bretagne Sud, Lorient.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the CeCILL-B license available
 * at :/*from w ww . ja va2  s  .c om*/
 * en : http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 * fr : http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html
 * 
 * Contributors:
 * Dominique BLOUIN (Lab-STICC UBS), dominique.blouin@univ-ubs.fr
 ******************************************************************************/

import java.util.Arrays;

public class Main {
    public static int indexOf(final String[] p_elements, final String p_key) {
        if (p_elements == null) {
            return -1;
        }

        return Arrays.asList(p_elements).indexOf(p_key);
    }
}

Related

  1. arrayIndexOffset(int index, long baseOffset, long indexScale)
  2. indexOf(byte[] array, byte[] target, int fromIndex)
  3. indexOf(byte[] array, byte[] target, int start)
  4. indexOf(byte[] target, byte[] key)
  5. indexOf(char toBeFound, char[] array)
  6. indexOf(final T[] array, final T value)
  7. indexOf(int[] arr, int e)
  8. indexOf(int[] arr, int val)
  9. indexOf(Object[] array, Object objectToFind)