Palio
Palio

Reputation: 21

Convert List<String> to Mono<List<String<>> Java WebFlux

I'm trying to convert a list of string to Mono of List of String in Java using web WebFlux, maybe its easy but I can't find the solution.

This is the List

List<String> lstString = new ArrayList<>();
lstString.add("Hello");
lstString.add("How");
lstString.add("are");
lstString.add("you?");


//Expected result
Mono<List<String>> lstMonoList =lstString.stream.map()....

I tried to use stream, flatmap and map methods but often I get response as stream() o List

Can anyone help me?, Thanks in advance

Upvotes: 1

Views: 5716

Answers (1)

duppydodah
duppydodah

Reputation: 195

If you want to wrap it in a mono then, use Mono.just(lstString);. I would recommend looking at the documentation for Mono & Flux as well.

Upvotes: 6

Related Questions