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());
I'm totally confused. Thank you.
Aucun commentaire:
Enregistrer un commentaire