java-design-patterns/collection-pipeline
Narendra Pathai 2aa9e78ddd
Minor refactorings and code style changes (#807)
* Made minor changes in some patterns such as removed throws clause where not needed, changed incorrect order of arguments in assertEquals

* Minor refactorings and code style changes. 1) Removed several use of raw types 2) Removed unnecessary throws clauses 3) Used lambda expressions wherever applicable 4) Used apt assertion methods for readability 5) Use of try with resources wherever applicable 6) Corrected incorrect order of assertXXX arguments

* Removed unused import from Promise

* Addressed review comments

* Addressed checkstyle issue
2018-10-23 13:45:41 +05:30
..
2018-09-08 20:38:04 +05:30
2018-09-01 15:48:36 +05:30

layout, title, folder, permalink, categories, tags
layout title folder permalink categories tags
pattern Collection Pipeline collection-pipeline /patterns/collection-pipeline/ Functional
Java
Difficulty-Beginner
Functional

Intent

Collection Pipeline introduces Function Composition and Collection Pipeline, two functional-style patterns that you can combine to iterate collections in your code. In functional programming, it's common to sequence complex operations through a series of smaller modular functions or operations. The series is called a composition of functions, or a function composition. When a collection of data flows through a function composition, it becomes a collection pipeline. Function Composition and Collection Pipeline are two design patterns frequently used in functional-style programming.

alt text

Applicability

Use the Collection Pipeline pattern when

  • When you want to perform a sequence of operations where one operation's collected output is fed into the next
  • When you use a lot of statements in your code
  • When you use a lot of loops in your code

Credits