Skip to content

Commit 5aedf47

Browse files
Feature: Added notes on Supplier in the Readme file.
1 parent 957dfa9 commit 5aedf47

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,22 @@ static Predicate<String> isPhoneNumberValidPredicate = phoneNumber ->
182182

183183
## Explanation Supplier
184184

185+
**Supplier<T>**: Represents a supplier of results. It takes no input and gives an object/list of objects as output.
186+
187+
188+
Supplier is implemented in _Supplier_ class in the project. In the supplier class, a supplier object
189+
190+
```java
191+
192+
static Supplier<String> getDBConnectionUrlsSupplier = ()
193+
-> DUMMY_DATABASE_CONNECTION_URL;
194+
195+
```
196+
197+
is created which nothing as input and delivers a String as output. In the main method, the supplier is called via __get() function__.
198+
199+
**Reference:** The source code for the Supplier is present in [_Supplier.java](https://github.com/syedumerahmedcode/java-functional-programming/blob/master/src/main/java/com/umer/javafunctional/functionalinterface/_Supplier.java) class.
200+
185201
- Add a picture linking imperative and declarative approach together.
186202

187203
## Explanation Lambdas

notes.md

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
Some methods used in the project:
66

77

8-
9-
10-
- **Supplier<T>**: Represents a supplier of results.
11-
128
These are coming from Stream API.
139
- **map()**: Used for the transformation of an object. It returns a stream consisting of the results of applying the given function to the elements of this stream. What is returned depends on how the function is implemented inside map method.
1410
- **collect()**: Performs some kind of reduction operation on the elements of the stream. In our case, we are using Collector API from Stream.

0 commit comments

Comments
 (0)