-
Notifications
You must be signed in to change notification settings - Fork 26
Drozdov Igor Future part1 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
||
// TODO get Optional<first name> from optPerson | ||
final Optional<String> optFirstName = null; | ||
final Optional<String> optFirstName = optPerson.flatMap(p -> Optional.of(p.getFirstName())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use map
|
||
// TODO Get Stream<first name> from streamPerson | ||
final Stream<String> streamFirstName = null; | ||
final Stream<String> streamFirstName = streamPerson.flatMap(p -> Stream.of(person.getFirstName())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use map
|
||
// TODO Get CompletableFuture<first name> from futurePerson | ||
final CompletableFuture<String> futureFirstName = null; | ||
final CompletableFuture<String> futureFirstName = futurePerson.thenCompose(p -> CompletableFuture.completedFuture(p.getFirstName())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use thenApply
No description provided.