Skip to content

Commit 1487d91

Browse files
Feature: Added information on consumer in readme file.
1 parent ed74971 commit 1487d91

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ A callback is some code that you pass to a given method, so that it can be calle
8282

8383
## Explanation Consumer
8484

85+
- **Consumer<T>**: Represents an operation that accepts a single input argument and returns no result. It is similar to a void function when compared to imperative implementation.
86+
87+
This is implemented is Consumer class in the project. In the consumer class, a consumer object is created which takes Customer as input and prints the information on the command line. In the main method, the consumer is called via __accept() function__.
88+
89+
Similar to Consumer, one can also create BiConsumer which takes two parameters as input(instead of one) but like consumer does not return any output.
90+
91+
**Reference:** The source code for the Consumer is present in [Callback.java](https://github.com/syedumerahmedcode/java-functional-programming/blob/master/src/main/java/com/umer/javafunctional/functionalinterface/_Consumer.java) class.
92+
8593
- Add a picture linking imperative and declarative approach together.
8694

8795
## Explanation Function

0 commit comments

Comments
 (0)