Skip to content

happyharbor/future-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Future Library

CircleCI Maven Central SonarCloud Coverage Sonarcloud Status Technical Debt SonarCloud Vulnerabilities GitHub license

A Completable Future library for java that help you make tedious transformations and error handling easier

Future Collectors

A collection of collectors that help write functional code.

List<CompletableFuture<T> to CompletableFuture<List<T>>

When dealing with Completable Futures there are many times that you will arrive at a point that you have a list of completable futures, and you would like to continue creating executions paths with the help of thenApply etc.

Unfortunately this is not possible with a list, it would have to be a completable future list and that is what this set of collectors is doing. There three alternatives:

  • sequenceCollector: The most basic usage that will collect your Stream of CompletableFuture to a List<CompletableFuture. Upon error, the error will be logged, and the future will complete exceptionally.
  • sequenceStreamCollector: Same as the previous, but it will return a Stream<CompletableFuture
  • sequenceNoFailCollector: Unlike the previous two, this collector will log the error, but it will finish normally.

License

This project is licensed under MIT license.

Packages

No packages published

Languages