Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What is the purpose of the Comparator interface?
Think about how you would sort a list differently than its natural order.
How do you make a collection unmodifiable?
Recall the Collections class in Java.
What is the primary use of the Comparator interface?
Think about when you might need a different order.
True or False: All collections in Java can be modified.
Remember the concept of immutability in collections.
Create a custom comparator that sorts a list of Employee objects first by their salary in descending order, and then by their name in alphabetical order if salaries are equal. Write code to demonstrate this.
Focus on how to prioritize the salary field first.
Discuss potential risks of using synchronized collections and propose best practices for their use.
Think about what can go wrong when multiple threads are accessing shared data.
5 more questions in this section. Enroll free to practise them all.
Enroll free