Given:
13. public static void search(List list) {
14. list.clear();
15. list.add(”b”);
16. list.add(”a”);
17. list.add(”c”);
18. System.out.println(Collections.binarySearch(list, “a”));
19. }
What is the result of calling search with a valid List implementation?
1 or The result is undefined
s***y 发帖数: 124
2
Undefined.
list needs to be sorted first.
Collections.sort(list);