March 2002
Intermediate to advanced
496 pages
8h 51m
English
Chapter 21, Template Method, described sorting as an example of the TEMPLATE METHOD pattern. You can use the sort() algorithm from the Collections class to sort any list of objects, so long as you supply a step to compare two objects. But you might argue that when you supply a comparison step to a sorting algorithm, you are changing the strategy. For instance, if you are selling rockets, presenting them sorted by price is a different marketing strategy from presenting them sorted by thrust.
|
Read now
Unlock full access