🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Observer
  2. B.Decorator
  3. C.Strategy
  4. 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 →