// Create a list with an ordered list of strings
String [] str = new String("ant", "bat", "cat", "dog");
List sortedList = Arrays.asList();
Collections.sort(sortedList);
// Search for the word "cat"
int index = Collections.binarySearch(sortedList, "cat"); // 2
// Search for a non-existent element
index = Collections.binarySearch(sortedList, "cow"); // -4
e martë, 12 qershor 2007
Abonohu te:
Posto komente (Atom)
Nuk ka komente:
Posto një koment