Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static int indexOfFirst(Object[] array, Class<?> type) { if (!isEmpty(array)) { int N = -1; for (Object one : array) { N++; if (one != null && type == one.getClass()) { return N; } } } return -1; } public static <T> boolean isEmpty(T[] array) { return array == null || array.length == 0; } }