Returns the index of the lowest element == the given search target,
or -1
@return index or -1 if not found
356248
private int binaryFirstSearch() {

        int low     = 0;
        int high    = count;
        int mid     = 0;
        int compare = 0;
        int found   = count;

        while (low < high) {
            mid     = (low + high) / 2;
            compare = compare(mid);

            if (compare < 0) {
                high = mid;
            } else if (compare > 0) {
                low = mid + 1;
            } else {
                high  = mid;
                found = mid;
            }
        }

        return found == count ? -1
                              : found;
    }
883556
private int sieveSearch(int limit, int start) {
        if (start >= limit)
            return -1;

        int index = start;
        do {
            if (!get(index))
                return index;
            index++;
        } while(index < limit-1);
        return -1;
    }
781241
public static int indexOf (int[] list, int value)
    {
        int llength = list.length; // no optimizing bastards
        for (int i = 0; i < llength; i++) {
            if (list[i] == value) {
                return i;
            }
        }
        return -1;
    }
1018651
public int findFirst(String str, String search) {
        return (str == null || search == null) ? -1 :
            str.indexOf(search);
    }
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;
    }
149498
@SuppressWarnings("unlikely-arg-type")
	@Pure
	public int indexOf(P element) {
		int idx = 0;
		for (final GridCellElement<P> e : this.elements) {
			if (e.isReferenceCell(this)) {
				if (e.equals(element)) {
					return idx;
				}
				++idx;
			}
		}
		return -1;
	}
1122736
public int lookupIndex(short value) {
        for (int i=0; i<elements.length; i++) {
            if (elements[i] == value) {
                return i;
            }
        }
        return -1;
    }
1316689
private int indexOf(int key) {
		int startIndex = hashIndex(key);
		int index = startIndex;

		for (;;) {
			if (values[index] == null) {
				// It's available, so no chance that this value exists anywhere in the map.
				return -1;
			}
			if (key == keys[index]) {
				return index;
			}

			// Conflict, keep probing ...
			if ((index = probeNext(index)) == startIndex) {
				return -1;
			}
		}
	}
1348706
private int getKeyIndex(int key) {
    reindexItems();

    int index = Arrays.binarySearch(sortedKeys, key);
    if (index >= 0) {
      int prevIndex = index - 1;
      while (prevIndex >= 0 && sortedKeys[prevIndex] == key) {
        index = prevIndex;
        prevIndex = index - 1;
      }
      return index;
    } else {
      return -1;
    }
  }
76291
public int locateIndex(int index) {

        int min = 0;
        int max = this.indexValues.length - 1;

        if (max == -1) {
            return -1;
        }

        // Binary search
        while ((this.indexValues[min] <= index) && (this.indexValues[max] >= index)) {
            int current = (max + min) / 2;
            if (this.indexValues[current] > index) {
                max = current - 1;
            } else if (this.indexValues[current] < index) {
                min = current + 1;
            } else {
                return current;
            }
        }
        if (this.indexValues[max] < index) {
            return max;
        } else {
            return min - 1;
        }
    }
668399
@Pure
	public int indexOf(P element) {
		int idx;
		int globalIdx = 0;
		for (final GridCell<P> cell : getGridCells()) {
			idx = cell.indexOf(element);
			if (idx != -1) {
				return globalIdx + idx;
			}
			globalIdx += cell.getReferenceElementCount();
		}
		return -1;
	}
194740
public int indexOf(Object o) {
		try {
			for (int i = 0; i < events.size(); i++) {
				if (events.get(i).equals(o)) {
					return i;
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return -1;
	}
1173311
function findIndex( array, condition ) {

    for ( let i = 0; i < array.length; ++i ) {

        if ( condition( array[ i ], i ) ) return i;

    }

    return -1;

}
107431
public int getIndexMin() {
        int indexMin = 0;
        double min = getEigenvalue(0).getMagnitude2();

        final int N = getNumberOfEigenvalues();
        for( int i = 1; i < N; i++ ) {
            double m = getEigenvalue(i).getMagnitude2();
            if( m < min ) {
                min = m;
                indexMin = i;
            }
        }

        return indexMin;
    }
937814
private int findMinGrandChild(Comparator comparator, int index)
  {
    int leftChildIndex = getLeftChildIndex(index);
    if (leftChildIndex < 0) {
      return -1;
    }
    return findMin(comparator, getLeftChildIndex(leftChildIndex), 4);
  }
391862
private int binarySlotSearch() {

        int low     = 0;
        int high    = count;
        int mid     = 0;
        int compare = 0;

        while (low < high) {
            mid     = (low + high) / 2;
            compare = compare(mid);

            if (compare <= 0) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        return low;
    }
576544
public int getNodeIndex(final Node node) {
        for (int i = 0; i < nodeList.size(); i++) {
            if (nodeList.get(i).equals(node)) {
                return i;
            }
        }
        return -1;
    }