Java tutorial
//package com.java2s; /* * Copyright (C) 2009 Emweb bvba, Leuven, Belgium. * * See the LICENSE file for terms of use. */ import java.util.Collections; import java.util.Comparator; import java.util.List; public class Main { public static <V, Compare extends Comparator<V>> int insertionPoint(List<V> list, V item, Compare compare) { int i = Collections.binarySearch(list, item, compare); if (i < 0) { return -1 - i; } else return i; } }