Android Utililty Methods Array Index Of

List of utility methods to do Array Index Of

Description

The list of methods to do Array Index Of are organized into topic(s).

Method

intindexOf(long[] array, long valueToFind, int startIndex)

Finds the index of the given value in the array starting at the given index.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex is treated as zero.

if (array == null) {
    return INDEX_NOT_FOUND;
if (startIndex < 0) {
    startIndex = 0;
for (int i = startIndex; i < array.length; i++) {
    if (valueToFind == array[i]) {
...
intindexOf(short[] array, short valueToFind)

Finds the index of the given value in the array.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

return indexOf(array, valueToFind, 0);
intindexOf(short[] array, short valueToFind, int startIndex)

Finds the index of the given value in the array starting at the given index.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex is treated as zero.

if (array == null) {
    return INDEX_NOT_FOUND;
if (startIndex < 0) {
    startIndex = 0;
for (int i = startIndex; i < array.length; i++) {
    if (valueToFind == array[i]) {
...
intindexOfByReference(T e, T[] array)
index Of By Reference
for (int i = 0; i != array.length; ++i) {
    if (array[i] == e)
        return i;
return -1;