Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Perhaps not in Java but in C# it is quite common to do

    var tasks = names.Select(GetThingAsync); // IEnumerable<Task<Thing>>
    var things = Task.WhenAll(tasks);        // Task<Thing[]>, await to get Thing[]
Can mix and match with other LINQ methods. There are other useful methods like Parallel.ForEachAsync, .AsParallel (Java has a similar abstraction) and IAsyncEnumerable for asynchronously "streaming back" a sequence of results which let you compose the tasks in an easy way.


Maybe what you wrote is clear to other LINQ users, but as a short feedback, your point is not easily understandable for people who don't know much about it.

As in, from outside, it looks like you are in there way deep, but it might need some more work to go and fetch the (assumed) target audience.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: