Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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.