class ListUtil {

	@Pure
	public static <T> int higherIndex(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) {
				final int center = (first + last) / 2;
				final T indata = list.get(center);
				final int cmp = comparator.compare(elt, indata);
				if (cmp < 0) {
					last = center - 1;
				} else {
					first = center + 1;
				}
			}
			++last;
			if (last >= list.size()) {
				last = -1;
			}
			return last;
		} catch (AssertionError e) {
			throw e;
		} catch (Throwable exception) {
			return -1;
		}
	}

	private  ListUtil();

}