@Pure
	public static <T> int indexOf(List<T> list, Comparator<? super T> comparator, T elt) {
		try {
			assert comparator != null;
			assert list != null;
			if (elt == null) {
				return -1;
			}

			int first = 0;
			int last = list.size() - 1;

			while (last >= first) {
				int center = (first + last) / 2;
				final T indata = list.get(center);
				final int cmp = comparator.compare(elt, indata);
				if (cmp == 0) {
					do {
						--center;
					}
					while (center >= 0 && comparator.compare(elt, list.get(center)) == 0);
					return center + 1;
				} else if (cmp < 0) {
					last = center - 1;
				} else {
					first = center + 1;
				}
			}
		} catch (AssertionError e) {
			throw e;
		} catch (Throwable exception) {
			//
		}
		return -1;
	}
@ Pure public static < T > int indexOf ( List < T > list , Comparator < ? super T > comparator , T elt ) { try { assert comparator != null ; assert list != null ; if ( elt == null ) { return - 1 ; } int first = 0 ; int last = list . size ( ) - 1 ; while ( last >= first ) { int center = ( first + last ) / 2 ; final T indata = list . get ( center ) ; final int cmp = comparator . compare ( elt , indata ) ; if ( cmp == 0 ) { do { -- center ; } while ( center >= 0 && comparator . compare ( elt , list . get ( center ) ) == 0 ) ; return center + 1 ; } else if ( cmp < 0 ) { last = center - 1 ; } else { first = center + 1 ; } } } catch ( AssertionError e ) { throw e ; } catch ( Throwable exception ) { } return - 1 ; }
Replies the index of the given data in the given list according to a
dichotomic search algorithm. Order between objects
is given by {@code comparator}.

<p>This function assumes that the given list is sorted
according to the given comparator.
A dichotomic algorithm is used.

@param <T> is the type of the data to search for.
@param list is the list inside which the element should be searched.
@param comparator is the comparator used to sort the list.
@param elt is the element to search for.
@return the index at which the element is, or <code>-1</code> if
the element was not found.