Java tutorial
import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; public class Main { public static void main(String[] argv) throws Exception { List<String> sortedList = new LinkedList<String>(); sortedList.addAll(Arrays.asList(new String[] { "a", "b", "c", "d" })); int index = Collections.binarySearch(sortedList, "c"); index = Collections.binarySearch(sortedList, "cc"); } } //A negative return value indicates that the element is not in the list.