Lines Matching refs:key

1801      * @param key the value to be searched for
1802 * @return index of the search key, if it is contained in the array;
1805 * key would be inserted into the array: the index of the first
1806 * element greater than the key, or <tt>a.length</tt> if all
1807 * elements in the array are less than the specified key. Note
1809 * and only if the key is found.
1811 public static int binarySearch(long[] a, long key) {
1812 return binarySearch0(a, 0, a.length, key);
1830 * @param key the value to be searched for
1831 * @return index of the search key, if it is contained in the array
1835 * key would be inserted into the array: the index of the first
1836 * element in the range greater than the key,
1838 * elements in the range are less than the specified key. Note
1840 * and only if the key is found.
1848 long key) {
1850 return binarySearch0(a, fromIndex, toIndex, key);
1855 long key) {
1863 if (midVal < key)
1865 else if (midVal > key)
1868 return mid; // key found
1870 return -(low + 1); // key not found.
1882 * @param key the value to be searched for
1883 * @return index of the search key, if it is contained in the array;
1886 * key would be inserted into the array: the index of the first
1887 * element greater than the key, or <tt>a.length</tt> if all
1888 * elements in the array are less than the specified key. Note
1890 * and only if the key is found.
1892 public static int binarySearch(int[] a, int key) {
1893 return binarySearch0(a, 0, a.length, key);
1911 * @param key the value to be searched for
1912 * @return index of the search key, if it is contained in the array
1916 * key would be inserted into the array: the index of the first
1917 * element in the range greater than the key,
1919 * elements in the range are less than the specified key. Note
1921 * and only if the key is found.
1929 int key) {
1931 return binarySearch0(a, fromIndex, toIndex, key);
1936 int key) {
1944 if (midVal < key)
1946 else if (midVal > key)
1949 return mid; // key found
1951 return -(low + 1); // key not found.
1963 * @param key the value to be searched for
1964 * @return index of the search key, if it is contained in the array;
1967 * key would be inserted into the array: the index of the first
1968 * element greater than the key, or <tt>a.length</tt> if all
1969 * elements in the array are less than the specified key. Note
1971 * and only if the key is found.
1973 public static int binarySearch(short[] a, short key) {
1974 return binarySearch0(a, 0, a.length, key);
1992 * @param key the value to be searched for
1993 * @return index of the search key, if it is contained in the array
1997 * key would be inserted into the array: the index of the first
1998 * element in the range greater than the key,
2000 * elements in the range are less than the specified key. Note
2002 * and only if the key is found.
2010 short key) {
2012 return binarySearch0(a, fromIndex, toIndex, key);
2017 short key) {
2025 if (midVal < key)
2027 else if (midVal > key)
2030 return mid; // key found
2032 return -(low + 1); // key not found.
2044 * @param key the value to be searched for
2045 * @return index of the search key, if it is contained in the array;
2048 * key would be inserted into the array: the index of the first
2049 * element greater than the key, or <tt>a.length</tt> if all
2050 * elements in the array are less than the specified key. Note
2052 * and only if the key is found.
2054 public static int binarySearch(char[] a, char key) {
2055 return binarySearch0(a, 0, a.length, key);
2073 * @param key the value to be searched for
2074 * @return index of the search key, if it is contained in the array
2078 * key would be inserted into the array: the index of the first
2079 * element in the range greater than the key,
2081 * elements in the range are less than the specified key. Note
2083 * and only if the key is found.
2091 char key) {
2093 return binarySearch0(a, fromIndex, toIndex, key);
2098 char key) {
2106 if (midVal < key)
2108 else if (midVal > key)
2111 return mid; // key found
2113 return -(low + 1); // key not found.
2125 * @param key the value to be searched for
2126 * @return index of the search key, if it is contained in the array;
2129 * key would be inserted into the array: the index of the first
2130 * element greater than the key, or <tt>a.length</tt> if all
2131 * elements in the array are less than the specified key. Note
2133 * and only if the key is found.
2135 public static int binarySearch(byte[] a, byte key) {
2136 return binarySearch0(a, 0, a.length, key);
2154 * @param key the value to be searched for
2155 * @return index of the search key, if it is contained in the array
2159 * key would be inserted into the array: the index of the first
2160 * element in the range greater than the key,
2162 * elements in the range are less than the specified key. Note
2164 * and only if the key is found.
2172 byte key) {
2174 return binarySearch0(a, fromIndex, toIndex, key);
2179 byte key) {
2187 if (midVal < key)
2189 else if (midVal > key)
2192 return mid; // key found
2194 return -(low + 1); // key not found.
2207 * @param key the value to be searched for
2208 * @return index of the search key, if it is contained in the array;
2211 * key would be inserted into the array: the index of the first
2212 * element greater than the key, or <tt>a.length</tt> if all
2213 * elements in the array are less than the specified key. Note
2215 * and only if the key is found.
2217 public static int binarySearch(double[] a, double key) {
2218 return binarySearch0(a, 0, a.length, key);
2237 * @param key the value to be searched for
2238 * @return index of the search key, if it is contained in the array
2242 * key would be inserted into the array: the index of the first
2243 * element in the range greater than the key,
2245 * elements in the range are less than the specified key. Note
2247 * and only if the key is found.
2255 double key) {
2257 return binarySearch0(a, fromIndex, toIndex, key);
2262 double key) {
2270 if (midVal < key)
2272 else if (midVal > key)
2276 long keyBits = Double.doubleToLongBits(key);
2285 return -(low + 1); // key not found.
2298 * @param key the value to be searched for
2299 * @return index of the search key, if it is contained in the array;
2302 * key would be inserted into the array: the index of the first
2303 * element greater than the key, or <tt>a.length</tt> if all
2304 * elements in the array are less than the specified key. Note
2306 * and only if the key is found.
2308 public static int binarySearch(float[] a, float key) {
2309 return binarySearch0(a, 0, a.length, key);
2328 * @param key the value to be searched for
2329 * @return index of the search key, if it is contained in the array
2333 * key would be inserted into the array: the index of the first
2334 * element in the range greater than the key,
2336 * elements in the range are less than the specified key. Note
2338 * and only if the key is found.
2346 float key) {
2348 return binarySearch0(a, fromIndex, toIndex, key);
2353 float key) {
2361 if (midVal < key)
2363 else if (midVal > key)
2367 int keyBits = Float.floatToIntBits(key);
2376 return -(low + 1); // key not found.
2395 * @param key the value to be searched for
2396 * @return index of the search key, if it is contained in the array;
2399 * key would be inserted into the array: the index of the first
2400 * element greater than the key, or <tt>a.length</tt> if all
2401 * elements in the array are less than the specified key. Note
2403 * and only if the key is found.
2404 * @throws ClassCastException if the search key is not comparable to the
2407 public static int binarySearch(Object[] a, Object key) {
2408 return binarySearch0(a, 0, a.length, key);
2432 * @param key the value to be searched for
2433 * @return index of the search key, if it is contained in the array
2437 * key would be inserted into the array: the index of the first
2438 * element in the range greater than the key,
2440 * elements in the range are less than the specified key. Note
2442 * and only if the key is found.
2443 * @throws ClassCastException if the search key is not comparable to the
2452 Object key) {
2454 return binarySearch0(a, fromIndex, toIndex, key);
2459 Object key) {
2466 int cmp = midVal.compareTo(key);
2473 return mid; // key found
2475 return -(low + 1); // key not found.
2490 * @param key the value to be searched for
2494 * @return index of the search key, if it is contained in the array;
2497 * key would be inserted into the array: the index of the first
2498 * element greater than the key, or <tt>a.length</tt> if all
2499 * elements in the array are less than the specified key. Note
2501 * and only if the key is found.
2504 * or the search key is not comparable to the
2507 public static <T> int binarySearch(T[] a, T key, Comparator<? super T> c) {
2508 return binarySearch0(a, 0, a.length, key, c);
2528 * @param key the value to be searched for
2532 * @return index of the search key, if it is contained in the array
2536 * key would be inserted into the array: the index of the first
2537 * element in the range greater than the key,
2539 * elements in the range are less than the specified key. Note
2541 * and only if the key is found.
2544 * or the search key is not comparable to the
2553 T key, Comparator<? super T> c) {
2555 return binarySearch0(a, fromIndex, toIndex, key, c);
2560 T key, Comparator<? super T> c) {
2562 return binarySearch0(a, fromIndex, toIndex, key);
2570 int cmp = c.compare(midVal, key);
2576 return mid; // key found
2578 return -(low + 1); // key not found.