# completable-futures
**Repository Path**: zenaster/completable-futures
## Basic Information
- **Project Name**: completable-futures
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-08-14
- **Last Updated**: 2025-09-03
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# completable-futures
[](https://github.com/spotify/completable-futures/actions/workflows/ci.yaml)
[](https://codecov.io/github/spotify/completable-futures?branch=master)
[](https://maven-badges.herokuapp.com/maven-central/com.spotify/completable-futures)
[](LICENSE)
completable-futures is a set of utility functions to simplify working with asynchronous code in
Java8.
## Usage
Using `completable-futures` requires Java 8 but has no additional dependencies. It is meant to be
included as a library in other software. To import it with maven, add this to your pom:
```xml
com.spotify
completable-futures
0.3.1
```
## Features
### Combining more than two things
The builtin CompletableFuture API includes `future.thenCombine(otherFuture, function)` but if you
want to combine more than two things it gets trickier. The `CompletableFutures` class contains the
following APIs to simplify this use-case:
#### allAsList
If you want to join a list of futures of uniform type, use `allAsList`. This returns a future which
completes to a list of all values of its inputs:
```java
List> futures = asList(completedFuture("a"), completedFuture("b"));
CompletableFuture> joined = CompletableFutures.allAsList(futures);
```
#### allAsMap
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:
```java
Map> futures = new HashMap() {{
put("key", completedFuture("value"));
}};
CompletableFuture