← Quiz: Observer, Strategy and Decorator: all 10 questions
Quiz: Observer, Strategy and Decorator · Question 3 of 10
Collections.sort(list, comparator) is an example of which pattern?
Collections.sort(list, comparator) is an example of which pattern?
- A.Observer
- B.Decorator
- C.Strategy
- D.Singleton
Answer & explanation
Correct answer: Strategy
The comparator is the plug-in algorithm that decides the order.
Can you get the rest right without peeking?
Take the timed Quiz: Observer, Strategy and Decorator quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →