Skip to content

Conversation

@gmessner
Copy link
Collaborator

Clarifies the use of Streams for both eager and lazy evaluation uses.

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
Copy link
Contributor

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.

Copy link
Collaborator Author

@gmessner gmessner Feb 11, 2019

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.

@gmessner gmessner merged commit 9f96966 into master Feb 11, 2019
@gmessner
Copy link
Collaborator Author

@mariuszs
Thanks for all your input.

@gmessner gmessner deleted the issue/lazy-stream-evaluation branch May 5, 2019 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants