Skip to content

Commit 529d54a

Browse files
authored
Added parallel Stream example.
1 parent f94a51d commit 529d54a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ Example usage:
163163
```java
164164
// Stream the visible Projects printing out the project name.
165165
gitlabApi.getProjectsApi().getProjectsStream().map(Project::getName).forEach(name -> System.out.println(name));
166+
167+
// Operate on the stream in parallel, this example sorts User instances by username
168+
Stream<User> stream = new UserApi(gitLabApi).getUsersStream();
169+
List<User> sortedUsers = stream.parallel().sorted(comparing(User::getUsername)).collect(toList());
166170
```
167171

168172
---

0 commit comments

Comments
 (0)