0

so the question is does stream api follow Chain of responsibilities or Decorator pattern in Java? Foe example

IntStream stream = IntStream.range(0, 100).filter(i -> i % 2 == 0).boxed();

Are we decorating IntStream with new functionallity thus creating decorated IntStream? If this is the case then is it an example of Decorator pattern? Or do we perform chain of responsibilities when collecting it to list when calling

strem.collect(Collectors.toList());
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Blogger 2015
  • 109
  • 1
  • 2
  • 11

0 Answers0