简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM