Question d’entretien chez Google

What is the strategy pattern in Java?

Réponse à la question d'entretien

Utilisateur anonyme

11 oct. 2010

Strategy pattern allows encapsulates algorithms into objects and selects one at runtime depending on some filter like data type. ie:) When you're parsing a set of data; if the data set usually has smaller size you can use the strategy that parses all. If the data set is usually large you can choose a strategy that breaks it up into chunks Wikipedia has good examples: http://en.wikipedia.org/wiki/Strategy_pattern#Java

1