An example of strategy pattern in Java