*/
package jalview.util;
+import java.util.Objects;
+
public class ArrayUtils
{
/**
}
}
}
+
+ /**
+ * Return the index of the first occurrence of the item in the array or -1 if
+ * the array doesn't contain the item.
+ *
+ * @param arr
+ * array to be searched
+ * @param item
+ * item to search for
+ * @return index of the first occurrence of the item or -1 if not found
+ */
+ public static int indexOf(Object[] arr, Object item)
+ {
+ for (int i = 0; i < arr.length; i++)
+ {
+ if (Objects.equals(arr[i], item))
+ return i;
+ }
+ return -1;
+ }
}