-
Notifications
You must be signed in to change notification settings - Fork 473
Java 8 Stream Documentation improvements #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
```java | ||
// Stream the visible Projects printing out the project name. | ||
gitlabApi.getProjectsApi().getProjectsStream().map(Project::getName).forEach(name -> System.out.println(name)); | ||
Stream projectsStream<Project> = gitlabApi.getProjectApi().getProjectsStream(); | ||
projectsStream.map(Project::getName).forEach(name -> System.out.println(name)); | ||
|
||
// Operate on the stream in parallel, this example sorts User instances by username |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is a good idea to give such an example here. Parallel operations are generally used for performance optimization, but here project gathering is so slow, that this operation doesn't add any improvement. As a result, the user can be confused that this operation can be super fast and this library can fetch data in multiple channels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parallel operations are often performed after fetching the data, parallel operations are not only used to speed up fetching, I have added more info to make the fact that reading of the data for the Stream cannot be done in parallel.
@mariuszs |
Clarifies the use of Streams for both eager and lazy evaluation uses.