Gets the first index of a given value in an array or -1 if not present.
343663
public static int indexOf(double[] array, double val) {
        for (int i=0; i<array.length; i++) {
            if (array[i] == val) {
                return i;
            }
        }
        return -1;
    }
10524
def _get_array_index(array_path):
    

    if not array_path.startswith('@'):
        raise XJPathError('Array index must start from @ symbol.')
    array_path = array_path[1:]
    if array_path == 'last':
        return -1
    if array_path == 'first':
        return 0
    if array_path.isdigit() or (array_path.startswith('-')
                                and array_path[1:].isdigit()):
        return int(array_path)
    else:
        raise XJPathError('Unknown index reference', (array_path,))
1131957
public static int indexOf(List<Node> list , int value ) {

		for (int i = 0; i < list.size(); i++) {
			if( list.get(i).which == value )
				return i;
		}

		return -1;
	}
736120
public int indexOf( byte value ) {
		for (int i = 0; i < size; i++) {
			if( data[i] == value )
				return i;
		}
		return -1;
	}
1106509
function first(arr, fn) {
  const l = arr.length;
  for (let i = 0; i < l; i += 1) {
    const res = fn(arr[i], i);
    if (res) {
      return res;
    }
  }

  return null;
}
984796
public int get1Value(int index) {
        try {
            return( value.get(index) );
        }
        catch (IndexOutOfBoundsException e) {
            Log.e(TAG, "X3D MFInt32 get1Value(index) out of bounds." + e);
        }
        catch (Exception e) {
            Log.e(TAG, "X3D MFInt32 get1Value(index) exception " + e);
        }
        return -1;
    }
838909
function(needle) {
        if (arr.indexOf) {
          return arr.indexOf(needle);
        } else {
          for (var i=0, length=arr.length; i<length; i++) {
            if (arr[i] === needle) { return i; }
          }
          return -1;
        }
    }
1293483
function findIndex (array, predicate) {
  for (let i = 0; i < array.length; i++) {
    if (predicate(array[i])) return i
  }
  return -1
}
478397
public int indexOf( T obj ) {
		for (int i = 0; i < size; i++) {
			if( data[i].equals(obj) ) {
				return i;
			}
		}
		return -1;
	}
666336
function indexOf(arr, searchval) {

        var min = 0;
        var max = arr.length - 1;
        var cur;

        while (min <= max) {

            cur = Math.floor((min + max) / 2);

            var curval = arr[cur];

            if (curval < searchval) {

                min = cur + 1;

            } else if (curval > searchval) {

                max = cur - 1;

            } else {

                return {found: true, index: cur};

            }

        }

        return {found: false, index: min};
    }
380405
public int first()
    {
        for (int ii=0;ii<array.length;ii++)
        {
            if (array[ii] != 0)
            {
                for (int jj=ii*8;jj<bits;jj++)
                {
                    if (isSet(jj))
                    {
                        return jj;
                    }
                }
            }
        }
        return -1;
    }
1282420
public static <T> T getFirst(T[] objectArray)
    {
        if (ArrayIterate.notEmpty(objectArray))
        {
            return objectArray[0];
        }
        return null;
    }
1118659
function(arr, iterator) {
  var i = arr.length - 1, index = null

  if(i >= 0){
    do {
      if(iterator(arr[i])) {
        index = i
        break
      }
    } while(i--)
  }

  return index
}
1051281
public int nextIndex() {
		int index = -1;
		for (int i = 0; i <  _values.length && index == -1; ++i) {
			if (Double.isNaN(_values[i])) {
				index = i;
			}
		}

		return index;
	}
576750
def p_array_index(self, p):
        ''''''
        if len(p) == 3:
            p[0] = slice(0, -1, -1)
        elif len(p) == 1 or p[1] == ':':
            p[0] = slice(0, -1, 1)
        else:
            p[0] = slice(0, int(p[1]), 1)
835955
function oneOf(arr, x) {
    check.verify.array(arr, 'expected an array');
    return arr.indexOf(x) !== -1;
  }
121911
function indexOf(array, value) {
  if (Array.prototype.indexOf) {
    return array.indexOf(value, Number(arguments[2]) || 0);
  }
  var len = array.length >>> 0, from = Number(arguments[2]) || 0;
  from = (from < 0) ? Math.ceil(from) : Math.floor(from);

  if (from < 0) from += len;

  for (; from < len; from++) {
    if (from in array && array[from] === value) return from;
  }
  return -1;
}