Java Array Index Of arrayIndex(T[] arr, T item)

Here you can find the source of arrayIndex(T[] arr, T item)

Description

array Index

License

Open Source License

Declaration

public static <T> int arrayIndex(T[] arr, T item) 

Method Source Code

//package com.java2s;

public class Main {
    public static <T> int arrayIndex(T[] arr, T item) {
        if (arr == null) {
            return -1;
        }//from ww  w  .  java 2  s .c om
        for (int i = 0; i < arr.length; i++) {
            if (arr[i].equals(item)) {
                return i;
            }
        }
        return -1;
    }
}

Related

  1. arrayIndexCheck(char[] text, int startPos, int endPos)
  2. arrayIndexClean(String indx)
  3. arrayIndexFor(final String raw)
  4. ArrayIndexOf(byte[] data, byte[] dest)