File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -141,13 +141,13 @@ List<Project> allProjects = projectPager.all();
141
141
142
142
---
143
143
## Java 8 Stream Support
144
- As of GitLab4J-API 4.9.2, you can also stream list based items in a Java 8 Stream using a Pager instance as follows:
144
+ As of GitLab4J-API 4.9.2, you can also stream list based items in a Java 8 Stream using a getProjectsStream() method as follows:
145
145
``` java
146
- // Get a Pager instance to get a Stream<Project> instance.
147
- Pager <Project > projectPager = gitlabApi. getProjectsApi (). getProjects( 10 );
146
+ // Get a Stream<Project> instance.
147
+ Stream <Project > projectPager = gitlabApi. getProjectApi (). getProjectsStream( );
148
148
149
149
// Stream the Projects printing out the project name.
150
- projectPager. stream() . map(Project :: getName). forEach(name - > System . out. println(name));
150
+ projectPager. map(Project :: getName). forEach(name - > System . out. println(name));
151
151
```
152
152
The following API classes also include ``` getXxxxxStream() ``` methods which return a Java 8 Stream:
153
153
```
@@ -162,7 +162,7 @@ UserApi
162
162
Example usage:
163
163
``` java
164
164
// Stream the visible Projects printing out the project name.
165
- gitlabApi. getProjectsApi (). getProjectsStream(). map(Project :: getName). forEach(name - > System . out. println(name));
165
+ gitlabApi. getProjectApi (). getProjectsStream(). map(Project :: getName). forEach(name - > System . out. println(name));
166
166
167
167
// Operate on the stream in parallel, this example sorts User instances by username
168
168
Stream<User > stream = new UserApi (gitLabApi). getUsersStream();
You can’t perform that action at this time.
0 commit comments