Loading…
Loading…
Ten exam-style questions on compareTo and compare, the return value contract, Comparator helper methods and chaining with reversed, Collections.sort versus TreeSet checks, and binarySearch results, with explanations.
Practice questions for the article Java Sorting: Comparable, Comparator, Collections.sort and binarySearch.
When you see a chain of comparator calls, work out what each step does before you look at the data. Aim for at least 8 out of 10.
Quiz path: step 64. Take the quizzes in this order, after reading each article.
Previous quiz: The Map Interface (OCP 21)
Next quiz: Sequenced Collections (OCP 21)
10 questions · pass at 68%
Check your understanding; you see the answers and explanations after submitting.
Discussion
Sign in to ask a question or share what you learned.