Return the position of the first occurrence of an
        item in an array, or -1 if the item is not included in the array.
963992
def indexOf(self, item, isSorted=False):
        
        array = self.obj
        ret = -1

        if not (self._clean.isList() or self._clean.isTuple()):
            return self._wrap(-1)

        if isSorted:
            i = _.sortedIndex(array, item)
            ret = i if array[i] is item else -1
        else:
            i = 0
            l = len(array)
            while i < l:
                if array[i] is item:
                    return self._wrap(i)
                i += 1
        return self._wrap(ret)
76876
public static <T> T getFirst(T array[]){
        return array!=null && array.length>0 ? array[0] : null;
    }
1370768
def index(value, array):
    
    i = array.searchsorted(value)
    if i == len(array): return -1
    else:               return i
830746
private static int findIndex(String[] array, String target){
        for (int i = 0; i < array.length; i++) {
            if (target.equals(array[i])) {
                return i;
            }
        }
        return -1;
    }
512762
public int first() {
        int val;
        int i;

        for (i = 0; i < data.length; i++) {
            if (data[i] != 0) {
                val = data[i];
                i <<= SHIFT;
                while ((val & 1) == 0) {
                    val >>>= 1;
                    i++;
                }
                return i;
            }
        }
        return -1;
    }
269601
function singleIndexOf(arr, v) {
  var pos = -1;
  var i, l;
  if (!arr) {
    return -1;
  }
  for (i = 0, l = arr.length; i < l; i++) {
    if (arr[i] === v) {
      if (pos >= 0) {
        return -2;
      }
      pos = i;
    }
  }
  return pos;
}
1282420
public static <T> T getFirst(T[] objectArray)
    {
        if (ArrayIterate.notEmpty(objectArray))
        {
            return objectArray[0];
        }
        return null;
    }
492671
function indexOfContainingItem(element, target) {
  const items = element.items;
  const itemCount = items ? items.length : 0;
  for (let i = 0; i < itemCount; i++) {
    let item = items[i];
    if (item === target || item.contains(target)) {
      return i;
    }
  }
  return -1;
}
490453
function first(array) {

  var n,
    getter,
    args;

  if(!isArray(array)) {
    return array;
  }

  args = Array.prototype.slice.call(arguments, 1);
  n = (isNumber(args[0])) ? args[0] : 1;
  getter = (!isNumber(args[0]))  ? args[0] : (!isNumber(args[1])) ? args[1] : undefined;

  return (args.length) ? getFirstMatches(array, n,(getter) ? $parse(getter) : getter) :
    array[0];
}
1142417
function remove (arr, item) {
  if (arr.length) {
    var index = arr.indexOf(item);
    if (index > -1) {
      return arr.splice(index, 1)
    }
  }
}
576710
public function indexOf( $item ) {

			for ( $i=0; $i < $this->len; $i++ ) {

				if ( $this->compare( $item, $this->items[$i] ) === 0 ) {
					return $i;
				}

			}

			return -1;

		}
582730
function findPosition(array, id) {
    var position = -1;

    for(var i = 0, len = array.length; i < len; i += 1) {
        if(array[i].$id === id) position = i;
    }

    return position;
}
848106
function(item, index) {
                var n = this.length,
                        i = ~~index
                if (i < 0)
                    i += n
                for (; i < n; i++)
                    if (this[i] === item)
                        return i
                return -1
            }
989315
def first_n_items(array, n_desired):
    """"""
    # Unfortunately, we can't just do array.flat[:n_desired] here because it
    # might not be a numpy.ndarray. Moreover, access to elements of the array
    # could be very expensive (e.g. if it's only available over DAP), so go out
    # of our way to get them in a single call to __getitem__ using only slices.
    if n_desired < 1:
        raise ValueError('must request at least one item')

    if array.size == 0:
        # work around for https://github.com/numpy/numpy/issues/5195
        return []

    if n_desired < array.size:
        indexer = _get_indexer_at_least_n_items(array.shape, n_desired,
                                                from_end=False)
        array = array[indexer]
    return np.asarray(array).flat[:n_desired]
78092
public static int lastIndexOf(short[] array, short value) {
		if (null != array) {
			for (int i = array.length - 1; i >= 0; i--) {
				if (value == array[i]) {
					return i;
				}
			}
		}
		return INDEX_NOT_FOUND;
	}
799909
function indexOf(items, item) {
    var len = items.length, i;
    for (i = 0; i < len; i++) {
      if (items[i] === item) {
        return i;
      }
    }
    return -1;
  }
60606
public int getIndex(T value) {
        int count = getItemCount();
        for (int i = 0; i < count; i++) {
            if (Objects.equals(getValue(i), value)) {
                return i;
            }
        }
        return -1;
    }