Closed mbruggmann closed 4 years ago
Merging #57 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #57 +/- ##
=======================================
Coverage 100% 100%
- Complexity 69 74 +5
=======================================
Files 6 6
Lines 191 202 +11
Branches 9 10 +1
=======================================
+ Hits 191 202 +11
Impacted Files | Coverage Δ | Complexity Δ | |
---|---|---|---|
...n/java/com/spotify/futures/CompletableFutures.java | 100% <100%> (ø) |
46 <6> (+5) |
:arrow_up: |
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 de76239...d244bd6. Read the comment docs.
Could we solve this generically? There are combinators in the standard library like collectingAndThen
etc., similarly here we could build a combinator that would only focus on the "wait for all futures" part and send the resulting future completions to a different collector.
It probably makes sense to have this method as well as a special case; it just might be worth thinking about this for the long run.
@dflemstr Not sure I fully grasp how the collector would work. Do you think we should investigate that before we add the joinMap collector to the public API?
I think so. Let us call this hypothetical combinator join()
. I would rather do join(toMap(...))
and join(toList())
and join(toSet())
etc. instead of treating each use-case individually.
@mbruggmann still want this? 😀
@mattnworb Guess I survived a while without it now, but if anyone feels like this is useful and worthwhile I can have a stab at cleaning it up?
I'll take a stab at creating what I wrote in my comment from 2018 :)
Now that we have allAsMap
(#70) I'll close this. If we want a collector version of it, we can add that as another PR and possibly revisit the API as @dflemstr suggested.
Description from README: joinMap is a stream collector that applies an asynchronous operation to a stream of values and collects the results into a map. This is similar to applying an asynchronous operation and using joinList, but retains the mapping from the original value.
There is probably a more optimized way of doing this but I thought I'd push it anyway since it was discussed.