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

Add Java 8 Optional Api map, flatmap #410

Merged
merged 1 commit into from
Apr 12, 2017

Conversation

sav007
Copy link
Contributor

@sav007 sav007 commented Apr 12, 2017

No description provided.

Copy link
Contributor

@digitalbuddha digitalbuddha left a comment

Choose a reason for hiding this comment

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

filter would be nice too if you're at it :-)

Just to point out this is making us different from Guava Optional so we will have harder time pulling in changes.

@sav007
Copy link
Contributor Author

sav007 commented Apr 12, 2017

@digitalbuddha the real intention of these changes is to have flat map, that will make chain look nicer:

before:

response -> response.data()
        .transform(it -> it.node.get())
        .transform(it -> it.asCheckout.get())
        .transform(it -> it.availableShippingRates.get())

after:

response -> response.data()
        .flatmap(::node)
        .flatmap(::asCheckout)
        .flatmap(::availableShippingRates)

@sav007 sav007 merged commit d913189 into apollographql:master Apr 12, 2017
@sav007 sav007 deleted the feature/optional-map-flatmap branch April 12, 2017 20:08
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