Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
83a05ad3
Unverified
Commit
83a05ad3
authored
6 years ago
by
Greg Messner
Committed by
GitHub
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fixed code sample for Optional use.
parent
c17f960b
main
5.0.x
5.0.x.jdk17
6.x
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+1
-1
README.md
with
1 addition
and
1 deletion
+1
-1
README.md
+
1
-
1
View file @
83a05ad3
...
...
@@ -219,7 +219,7 @@ projectPager.lazyStream().limit(5).map(Project::getName).forEach(name -> System.
### **Java 8 Optional Support**
GitLab4J-API supports Java 8 Optional
<
T
>
for API calls that result in the return of a single item. Here is an example on how to use the Java 8 Optional
<
T
>
API calls:
```
java
Optional
<
Group
>
optionalGroup
=
gitlabApi
.
getGroupApi
().
getGroup
(
"my-group-path"
);
Optional
<
Group
>
optionalGroup
=
gitlabApi
.
getGroupApi
().
get
Optional
Group
(
"my-group-path"
);
if
(
optionalGroup
.
isPresent
())
return
optionalGroup
.
get
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets