Skip to content
GitLab
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
Jul 07, 2019
by
Greg Messner
Committed by
GitHub
Jul 07, 2019
Browse files
Fixed code sample for Optional use.
parent
c17f960b
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
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
();
...
...
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