Skip to content
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

Drozdov Igor Future part1 #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

eye-dee
Copy link

@eye-dee eye-dee commented Jul 25, 2017

No description provided.


// TODO get Optional<first name> from optPerson
final Optional<String> optFirstName = null;
final Optional<String> optFirstName = optPerson.flatMap(p -> Optional.of(p.getFirstName()));

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()));

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()));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use thenApply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants