Is it correct to convert a CompletableFuture<Stream<T>> to a Publisher<T>?

    CompletableFuture<Stream<String>> teams = ...;
    Flux<String> teamsFlux = Mono.fromFuture(teams).flatMapMany(stream -> Flux.fromStream(stream));
EDIT:

Flux.fromStream(teams::join) is a code smell because it's holding a thread to fetch the result from CompletableFuture which is running on another thread.


Once you have downloaded the league table, and the team names are extracted from this table, I'm not sure you need a back-pressure ready stream to iterate over these items. A conversion of the stream to a standard list (or array) should be good enough, and should probably have better performance, no?

For instance:

String[] teamNames = teams.join().toArray(String[]::new);