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 allAsMap #70

Merged
merged 2 commits into from
Jun 3, 2020
Merged

Add allAsMap #70

merged 2 commits into from
Jun 3, 2020

Conversation

sashahe
Copy link
Contributor

@sashahe sashahe commented Jun 2, 2020

If you want to join a map of key and value-futures, each of uniform type, use allAsMap. This
returns a future which completes to a map of all key values of its inputs:

  Map<String, CompletableFuture<String>> futures = new HashMap() {{
    put("key", completedFuture("value"));
  }};
  CompletableFuture<Map<String, String>> joined = CompletableFutures.allAsMap(futures);

@codecov
Copy link

codecov bot commented Jun 2, 2020

Codecov Report

Merging #70 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              master       #70   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        80        84    +4     
===========================================
  Files              7         7           
  Lines            212       222   +10     
  Branches          14        16    +2     
===========================================
+ Hits             212       222   +10     
Impacted Files Coverage Δ Complexity Δ
...main/java/com/spotify/futures/CombinedFutures.java 100.00% <100.00%> (ø) 7.00 <7.00> (ø)
...n/java/com/spotify/futures/CompletableFutures.java 100.00% <100.00%> (ø) 49.00 <8.00> (+4.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25bbd6e...28030c2. Read the comment docs.

Copy link
Member

@mbruggmann mbruggmann left a comment

Choose a reason for hiding this comment

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

The implementation looks good to me. Would be nice to add something to the README?

@sashahe
Copy link
Contributor Author

sashahe commented Jun 2, 2020

I agree, I missed that. I added a description to the README

@mbruggmann mbruggmann merged commit 0a318f8 into spotify:master Jun 3, 2020
@mbruggmann mbruggmann mentioned this pull request Jun 8, 2020
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.

None yet

4 participants