1Z0-804 · Question #29
Given the integer implements comparable: What is the result?
The correct answer is D. 2. public static <T> int binarySearch(List<? extends Comparable<? super T>> list, T key) Searches the specified list for the specified object using the binary search algorithm. The list must be sorted into ascending order according to the natural ordering of its elements (as by…
Question
Given the integer implements comparable:
What is the result?
Exhibit
Options
- A4
- B1
- C3
- D2
- E2
How the community answered
(29 responses)- A3% (1)
- B3% (1)
- D79% (23)
- E14% (4)
Explanation
public static <T> int binarySearch(List<? extends Comparable<? super T>> list, T key) Searches the specified list for the specified object using the binary search algorithm. The list must be sorted into ascending order according to the natural ordering of its elements (as by the sort(List) method) prior to making this call. If it is not sorted, the results are undefined. list - the list to be searched. key - the key to be searched for. the index of the search key, if it is contained in the list; otherwise, (-(insertion point) - 1).
Topics
Community Discussion
No community discussion yet for this question.
